You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been experimenting with setting up a custom error handling mechanism that works for server functions globally in a catch-all manner, but with not much luck.
I've tried creating a global middleware that wraps the next() call in a try catch block like below, but it doesn't work becuase errors thrown in server functions are handled internally and is turned into a Response object here.
Also tried with server entry file approach, made a custom handler in server.ts but same thing seems to happen there as well. I'm wondering am I missing something? If not, I think being able to handle errors without errors caught and turned into a Response object would be a nice feature.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I've been experimenting with setting up a custom error handling mechanism that works for server functions globally in a catch-all manner, but with not much luck.
I've tried creating a global middleware that wraps the
next()call in a try catch block like below, but it doesn't work becuase errors thrown in server functions are handled internally and is turned into aResponseobject here.Also tried with server entry file approach, made a custom handler in
server.tsbut same thing seems to happen there as well. I'm wondering am I missing something? If not, I think being able to handle errors without errors caught and turned into a Response object would be a nice feature.Currently as a workaround I'm doing this:
Beta Was this translation helpful? Give feedback.
All reactions