Description
When an invalid URL is passed to useFetch, it throws an exception directly. This error isn't captured in the returned error field, nor can it be handled via the provided onError callback.
Throwing exceptions in react hooks also goes against best practices.
Steps To Reproduce
call useFetch with invalid URL,such as http://:8080
Current Behaviour
Throw an exception about invalid URL
Expected Behaviour
return the error in error or pass it into onError
Description
When an invalid URL is passed to
useFetch, it throws an exception directly. This error isn't captured in the returnederrorfield, nor can it be handled via the providedonErrorcallback.Throwing exceptions in react hooks also goes against best practices.
Steps To Reproduce
call
useFetchwith invalid URL,such ashttp://:8080Current Behaviour
Throw an exception about invalid URL
Expected Behaviour
return the error in
erroror pass it intoonError