Replies: 1 comment 5 replies
-
export const errorHandler =
<T extends unknown>(
loaderOrActionFn: (args: DataFunctionArgs) => Promise<T | Response> | T | Response
) =>
async (args: DataFunctionArgs) => {
try {
const res = await loaderOrActionFn(args);
return res;
} catch (err) {
await logError(err);
throw err;
}
}; can something like this work for you? then you would call it like this: export const action = errorHandler(async ({ request }) => {
//if something fails here it will be caught and logged
return stuff;
}); |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Problem
I try to catch this error on server.
but
ErrorBoundary
is client side handler.What i need
I need to catch error on server side (to send sentry)
For example,
Of course, we explicitly try-catch if possible on loader, but we cannot always pay attention to all possible exceptions during development. Especially when it comes to internal library errors.
Background
I am using @remix with @remix-run/cloudflare-pages. sentry/remix only supports node, so I need to write my own error handler, so I am trying to use toucan-js to catch errors more naively I am trying to use toucan-js which catches errors more naively. However, I can't seem to find a way to do that on remix.
https://github.com/robertcepa/toucan-js
https://github.com/getsentry/sentry-javascript/tree/master/packages/remix
related
#1522 (comment)
Beta Was this translation helpful? Give feedback.
All reactions