Skip to content

Commit 9eaef75

Browse files
code 911
1 parent 9367598 commit 9eaef75

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

lib/storage/file.js

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,11 @@ File.prototype.copy = function(destination, callback) {
208208
* piped to a writable stream or listened to for 'data' events to read a file's
209209
* contents.
210210
*
211+
* In the unlikely event there is a mismatch between what you downloaded and the
212+
* version in your Bucket, your error handler will receive an error with code
213+
* 911. If you receive this error, the best recourse is to try downloading the
214+
* file again.
215+
*
211216
* @example
212217
* //-
213218
* // <h4>Downloading a File</h4>
@@ -274,11 +279,14 @@ File.prototype.createReadStream = function() {
274279
if (that.metadata.md5Hash === localMd5Hash) {
275280
throughStream.emit('complete');
276281
} else {
277-
var error = new Error([
278-
'The downloaded data did not match the data from the server. ',
279-
'To be sure the content is the same, you should download the ',
280-
'file again.'
281-
].join(''));
282+
var error = new Error({
283+
code: 911,
284+
message: [
285+
'The downloaded data did not match the data from the server.',
286+
'To be sure the content is the same, you should download the',
287+
'file again.'
288+
].join(' ')
289+
});
282290

283291
throughStream.emit('error', error);
284292
}

0 commit comments

Comments
 (0)