We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
FetchError
When dealing with errors, it would be nice to have a function to assert the error is FetchError so that we can access underlining properties.
import { isFetchError } from 'sefirot/Http/Http' const m = useMutation(() => ...) try { m.execute() } catch (e) { if (isFetchError(e)) { if (e.data === 'Email already exists') { // ... } } }
And, maybe we could have more powerful API too? Not sure.
try { m.execute() } catch (e) { // Throw `e` if the error is not FetchError. // Else call closure. handleFetchErrorOrThrow(e, (e) => { // ... }) }
The text was updated successfully, but these errors were encountered:
Already added isFetchError in #539 🫠 should we export it form Api or Http?
isFetchError
Sorry, something went wrong.
Already added isFetchError in #539 🫠
That's my man 😄
should we export it form Api or Http?
Good point. Wasn't thinking about that. Hmmm I think it should be from Http...? Because the error is coming from Http and not from API 🤔 ...
brc-dd
Successfully merging a pull request may close this issue.
When dealing with errors, it would be nice to have a function to assert the error is FetchError so that we can access underlining properties.
And, maybe we could have more powerful API too? Not sure.
The text was updated successfully, but these errors were encountered: