Skip to content

Commit

Permalink
Fix error reporting in resumable-upload
Browse files Browse the repository at this point in the history
Existing error handling has wrong error serialization with .toString(), that leads to [object Object] error messages. 
Example:
 Error: Retry limit exceeded - [object Object]
 at Upload.attemptDelayedRetry (/usr/src/app/node_modules/@google-cloud/storage/build/cjs/src/resumable-upload.js:818:26)

Better solution would be JSON.stringify the error
  • Loading branch information
eagleeye authored Jun 27, 2024
1 parent 18eef67 commit d9dc756
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/resumable-upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1231,7 +1231,7 @@ export class Upload extends Writable {

if (retryDelay <= 0) {
this.destroy(
new Error(`Retry total time limit exceeded - ${resp.data}`)
new Error(`Retry total time limit exceeded - ${JSON.stringify(resp.data)}`)
);
return;
}
Expand All @@ -1252,7 +1252,7 @@ export class Upload extends Writable {
}
this.numRetries++;
} else {
this.destroy(new Error('Retry limit exceeded - ' + resp.data));
this.destroy(new Error(`Retry limit exceeded - ${JSON.stringify(resp.data)}`);
}
}

Expand Down

0 comments on commit d9dc756

Please sign in to comment.