-
Notifications
You must be signed in to change notification settings - Fork 54
Open
Description
If a chunk upload fails and the failed chunk upload callback is triggered, the preceding check accounts for the response potentially being undefined, but the callback itself does not.
This actually caused an issue in our production code where we couldn't even notify the user an error had ocurred because the "error" dispatch event never happened.
Here's the offending line:
https://github.com/muxinc/upchunk/blob/master/src/upchunk.ts#L749
I'm happy to open a PR, but couldn't find a contributions document. The message could simply be ammended to something along the lines of:
const message = res ? `Server responded with ${res.statusCode}. Stopping upload.` : 'Unable to connect with server. Stopping upload.';
this.dispatch('error', {
message,
chunk: this.chunkCount,
attempts: this.attemptCount,
response: res,
});
It's unclear what caused the error in the first place, but at least this way I can show a message to the user.
Metadata
Metadata
Assignees
Labels
No labels