diff --git a/src/resumable-upload.ts b/src/resumable-upload.ts index 5a1f71ccc..b12c27f09 100644 --- a/src/resumable-upload.ts +++ b/src/resumable-upload.ts @@ -1231,7 +1231,9 @@ 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; } @@ -1252,7 +1254,9 @@ 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)}`) + ); } } diff --git a/test/resumable-upload.ts b/test/resumable-upload.ts index da3ca97bc..0080767e0 100644 --- a/test/resumable-upload.ts +++ b/test/resumable-upload.ts @@ -1874,7 +1874,7 @@ describe('resumable-upload', () => { up.destroy = (err: Error) => { assert.strictEqual( err.message, - `Retry limit exceeded - ${RESP.data}` + `Retry limit exceeded - ${JSON.stringify(RESP.data)}` ); done(); }; @@ -1915,7 +1915,7 @@ describe('resumable-upload', () => { assert.strictEqual(up.numRetries, 3); assert.strictEqual( err.message, - `Retry limit exceeded - ${RESP.data}` + `Retry limit exceeded - ${JSON.stringify(RESP.data)}` ); done(); });