tus/tus-js-client

It's not possible to declare onShouldRetry and fallback to the default behaviour

hahn-kev opened this issue · 1 comments

Is your feature request related to a problem? Please describe.
I want to catch a specific server error and not retry, but now I lose online checking and the status code checking that happens by default.

Describe the solution you'd like
I would like to be able to detect and handle my error, then fallback to the default should retry implementation provided by the library.

Describe alternatives you've considered
I've tried to implement the same thing myself, but I don't want to rewrite all that code myself.

Can you provide help with implementing this feature?
One way to solve this would be to move the code here into the defaultOptions as the default value for the onShouldRetry option. Then I could access the default function and call it inside my function.

Additional context
Maybe I should be doing error handling differently, please let me know if that's the case, I'm still learning about tus.

One way to solve this would be to move the code here into the defaultOptions as the default value for the onShouldRetry option. Then I could access the default function and call it inside my function.

That is sensible proposal. I am not sure if there will be any complications if we basically set defaultOptions.onShouldRetry = shouldRetry, but we can try it out. Can you open a PR for this?