-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix server error logging and add onUnhandledError support (#6495)
- Loading branch information
1 parent
90cbe9a
commit c6d8c37
Showing
29 changed files
with
954 additions
and
487 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@remix-run/server-runtime": patch | ||
--- | ||
|
||
Ensure un-sanitized server errors are logged on the server during document requests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--- | ||
"@remix-run/server-runtime": minor | ||
--- | ||
|
||
Add optional `onUnhandledError` export for custom server-side error processing. This is a new optional export from your `entry.server.tsx` that will be called with any encountered error on the Remix server (loader, action, or render error): | ||
|
||
```ts | ||
// entry.server.tsx | ||
export function onUnhandledError( | ||
error: unknown, | ||
{ request, params, context }: DataFunctionArgs | ||
): void { | ||
if (error instanceof Error) { | ||
sendErrorToBugReportingService(error); | ||
console.error(formatError(error)); | ||
} else { | ||
let unknownError = new Error("Unknown Server Error"); | ||
sendErrorToBugReportingService(unknownError); | ||
console.error(unknownError); | ||
} | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.