Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: error serialization in resumable-upload.ts #2493

Merged
merged 4 commits into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
8 changes: 6 additions & 2 deletions src/resumable-upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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)}`)
);
}
}

Expand Down
4 changes: 2 additions & 2 deletions test/resumable-upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
};
Expand Down Expand Up @@ -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();
});
Expand Down
Loading