Open tdewolff opened 5 months ago
That's right, good point. We don't have errors that are thrown inside user callbacks well. This is likely not limited to onProgress
, but is also the case for onSuccess
, onError
, and onShouldRetry
. I wonder what the best way to handle those errors is:
onError
, signaling that the upload was stopped because of this error. If no onError
callback is registered, the errors is directly thrown.My first temptation would be to go with the first approach, which makes error handling more present. What do you think?
Thanks Marius for the quick reply! My initial expectation (adhering to the principle of least-surprise) would be that errors in callbacks are simply not caught/handled (and thus appear in the console as an error by default). Perhaps this would mean re-throwing the error. Otherwise, option one seems good!
If there is an error in the onProgress callback, instead of reporting the error in the console, the JS client sends out HEAD requests (instead of PATCH requests) which is quite confusing!
Example: