- Notifications
You must be signed in to change notification settings - Fork927
fix(site): show error on template upload failure#15558
New issue
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
onUpload: async (file: File) => { | ||
try { | ||
await uploadFileMutation.mutateAsync(file); | ||
} catch (error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I'm not familiar with this query library, but what I found is that even though you can setonError
, an exception returned frommutateAsync
isn't caught unless you explicitly catch it. So, If I displayed the error as part ofonError
inuseMutation
, I'd still need to wrapmutateAsync
in a try block, with an empty catch, which seems pointless.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
You did it correctly. We usually usemutateAsync
to keep the error handling close to where the mutation is called.
3650ef1
toa7781d0
Compare
BrunoQuaresmaNov 22, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Nice test 👍
a35c01d
intomainUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Closes#15441.