Skip to content

Commit d9dc756

Browse files
authored
Fix error reporting in resumable-upload
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
1 parent 18eef67 commit d9dc756

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/resumable-upload.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1231,7 +1231,7 @@ export class Upload extends Writable {
12311231

12321232
if (retryDelay <= 0) {
12331233
this.destroy(
1234-
new Error(`Retry total time limit exceeded - ${resp.data}`)
1234+
new Error(`Retry total time limit exceeded - ${JSON.stringify(resp.data)}`)
12351235
);
12361236
return;
12371237
}
@@ -1252,7 +1252,7 @@ export class Upload extends Writable {
12521252
}
12531253
this.numRetries++;
12541254
} else {
1255-
this.destroy(new Error('Retry limit exceeded - ' + resp.data));
1255+
this.destroy(new Error(`Retry limit exceeded - ${JSON.stringify(resp.data)}`);
12561256
}
12571257
}
12581258

0 commit comments

Comments
 (0)