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
Copy file name to clipboardExpand all lines: docs/how-to/error-boundary.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ title: Error Boundaries
11
11
12
12
To avoid rendering an empty page to users, route modules will automatically catch errors in your code and render the closest `ErrorBoundary`.
13
13
14
-
Error boundaries are not intended for error reporting or rendering form validation errors. Please see [Form Validation](./form-validation) and [Error Reporting](./error-reporting) instead.
14
+
Error boundaries are not intended for rendering form validation errors or error reporting. Please see [Form Validation](./form-validation) and [Error Reporting](./error-reporting) instead.
Copy file name to clipboardExpand all lines: docs/how-to/error-reporting.md
+84-6Lines changed: 84 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,22 +4,28 @@ title: Error Reporting
4
4
5
5
# Error Reporting
6
6
7
-
[MODES: framework]
7
+
[MODES: framework,data]
8
8
9
9
<br/>
10
10
<br/>
11
11
12
-
React Router catches errors in your route modules and sends them to [error boundaries](./error-boundary) to prevent blank pages when errors occur. However, ErrorBoundary isn't sufficient for logging and reporting errors. To access these caught errors, use the handleError export of the server entry module.
12
+
React Router catches errors in your route modules and sends them to [error boundaries](./error-boundary) to prevent blank pages when errors occur. However, `ErrorBoundary` isn't sufficient for logging and reporting errors.
13
13
14
-
## 1. Reveal the server entry
14
+
## Server Errors
15
15
16
-
If you don't see `entry.server.tsx` in your app directory, you're using a default entry. Reveal it with this cli command:
16
+
[modes: framework]
17
+
18
+
To access these caught errors on the server, use the `handleError` export of the server entry module.
19
+
20
+
### 1. Reveal the server entry
21
+
22
+
If you don't see [`entry.server.tsx`][entryserver] in your app directory, you're using a default entry. Reveal it with this cli command:
17
23
18
24
```shellscript nonumber
19
-
react-router reveal
25
+
react-router reveal entry.server
20
26
```
21
27
22
-
## 2. Export your error handler
28
+
###2. Export your error handler
23
29
24
30
This function is called whenever React Router catches an error in your application on the server.
To access these caught errors on the client, use the `onError` prop on your [`HydratedRouter`][hydratedrouter] or [`RouterProvider`][routerprovider] component.
52
+
53
+
### Framework Mode
54
+
55
+
[modes: framework]
56
+
57
+
#### 1. Reveal the client entry
58
+
59
+
If you don't see [`entry.client.tsx`][entryclient] in your app directory, you're using a default entry. Reveal it with this cli command:
60
+
61
+
```shellscript nonumber
62
+
react-router reveal entry.client
63
+
```
64
+
65
+
#### 2. Add your error handler
66
+
67
+
This function is called whenever React Router catches an error in your application on the client.
0 commit comments