Closed
Description
Turn snippet in https://docs.sentry.io/platforms/javascript/guides/remix/manual-setup/#v2-server-side-errors to handle non-error objects
export function handleError(
error: unknown,
{ request }: DataFunctionArgs
): void {
if (error instanceof Error) {
Sentry.captureRemixServerException(error, "remix.server", request);
} else {
// Optionally capture non-Error objects
Sentry.captureException(error);
}
}
export function handleError(
error: unknown,
{ request }: DataFunctionArgs
): void {
Sentry.captureRemixServerException(error, "remix.server", request);
}
Ideally we can even do a wrapper for handleError
export const handleError = Sentry.wrapRemixHandleError;
We also need to check for error.error
to identify an error:
{
"data": "Error: No route matches URL \"/wp-login.php\"",
"error": {
"message": "No route matches URL \"/wp-login.php\"",
"name": "Error",
"stack": "Error: No route matches URL \"/wp-login.php\"\n at getInternalRouterError (/app/apps/web/build/server.js:38878:63)\n at Object.query (/app/apps/web/build/server.js:37976:23)\n at handleDocumentRequestRR (/app/apps/web/build/server.js:40006:39)\n at requestHandler (/app/apps/web/build/server.js:39939:28)\n at /app/apps/web/build/server.js:41126:32"
},
"internal": true,
"status": 404,
"statusText": "Not Found"
}
Metadata
Metadata
Assignees
Labels
No labels