Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/common/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ function handleResp(err, resp, body, callback) {
return;
}
if (resp && (resp.statusCode < 200 || resp.statusCode > 299)) {
callback(new Error('error during request, statusCode: ' + resp.statusCode));
callback(new Error('error during request, statusCode: ' + resp.statusCode +
', body: ' + body));
return;
}
callback(null, body, resp);
Expand Down
8 changes: 7 additions & 1 deletion lib/datastore/transaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,13 @@ Transaction.prototype.makeReq = function(method, req, respType, callback) {
buffer = Buffer.concat([buffer, chunk]);
});
resp.on('end', function() {
callback(null, respType.decode(buffer));
util.handleResp(null, resp, buffer.toString(), function(err) {
if (err) {
callback(err);
return;
}
return callback(null, respType.decode(buffer));

This comment was marked as spam.

This comment was marked as spam.

});
});
});
remoteStream.on('error', callback);
Expand Down