Skip to content

Commit 61b04a1

Browse files
bigquery: check for apiResponse presence (#1853)
1 parent 978b1f5 commit 61b04a1

2 files changed

Lines changed: 2 additions & 3 deletions

File tree

packages/bigquery/src/job.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ Job.prototype.getQueryResultsStream = function(options) {
317317
*/
318318
Job.prototype.poll_ = function(callback) {
319319
this.getMetadata(function(err, metadata, apiResponse) {
320-
if (apiResponse.status && apiResponse.status.errors) {
320+
if (!err && apiResponse.status && apiResponse.status.errors) {
321321
err = common.util.ApiError(apiResponse.status);
322322
}
323323

packages/bigquery/test/job.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,11 +277,10 @@ describe('BigQuery/Job', function() {
277277

278278
describe('API error', function() {
279279
var error = new Error('Error.');
280-
var apiResponse = {};
281280

282281
beforeEach(function() {
283282
job.getMetadata = function(callback) {
284-
callback(error, null, apiResponse);
283+
callback(error);
285284
};
286285
});
287286

0 commit comments

Comments
 (0)