Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
### If you like this project, 🎉 [become a sponsor](https://github.com/sponsors/bvaughn/) or ☕ [buy me a coffee](http://givebrian.coffee/)

> [!NOTE]
> Projects using framework or runtimes that don't support ES Modules should use version 5 of this library.
> Projects using frameworks or runtimes that don't support ES Modules should use version 5 of this library.

## Getting started

Expand Down Expand Up @@ -62,11 +62,11 @@ This package is built on top of React [error boundaries](https://react.dev/refer

Error boundaries catch errors thrown while rendering the tree below them.

Error boundaries do not catch errors thrown during:
Error boundaries do not catch errors from:

- Server side rendering
- Server-side rendering
- Event handlers
- Errors thrown in the error boundary itself
- The error boundary itself
- Async code that runs after rendering, like `setTimeout` callbacks or unresolved promises

## Event handler and async errors
Expand Down Expand Up @@ -117,10 +117,10 @@ Wrap this component around other React components to "catch" errors and render a

Catches errors thrown while rendering the tree below it.

Does not catch errors thrown during:
- Server side rendering
Does not catch errors from:
- Server-side rendering
- Event handlers
- Errors thrown in the error boundary itself
- The error boundary itself
- Async code that runs after rendering, like `setTimeout` callbacks or unresolved promises

Event handler and async errors:
Expand Down
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!doctype html>
<html lang="en">
<head>
<title>react-error-boundary | runtime error handler</title>
<title>react-error-boundary | runtime error handling</title>

<link rel="icon" href="/favicon.ico" sizes="32x32" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
Expand All @@ -17,7 +17,7 @@
<meta property="og:site_name" content="react-error-boundary" />
<meta
property="og:title"
content="react-error-boundary: runtime error handler"
content="react-error-boundary: runtime error handling"
/>
<meta
name="description"
Expand Down
6 changes: 3 additions & 3 deletions lib/components/ErrorBoundary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ const initialState: ErrorBoundaryState = {
*
* Catches errors thrown while rendering the tree below it.
*
* Does not catch errors thrown during:
* - Server side rendering
* Does not catch errors from:
* - Server-side rendering
* - Event handlers
* - Errors thrown in the error boundary itself
* - The error boundary itself
* - Async code that runs after rendering, like `setTimeout` callbacks or unresolved promises
*
* Event handler and async errors:
Expand Down
2 changes: 1 addition & 1 deletion public/generated/docs/ErrorBoundary.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"content": "<p>Catches errors thrown while rendering the tree below it.</p>\n"
},
{
"content": "<p>Does not catch errors thrown during:</p>\n<ul>\n<li>Server side rendering</li>\n<li>Event handlers</li>\n<li>Errors thrown in the error boundary itself</li>\n<li>Async code that runs after rendering, like <code>setTimeout</code> callbacks or unresolved promises</li>\n</ul>\n"
"content": "<p>Does not catch errors from:</p>\n<ul>\n<li>Server-side rendering</li>\n<li>Event handlers</li>\n<li>The error boundary itself</li>\n<li>Async code that runs after rendering, like <code>setTimeout</code> callbacks or unresolved promises</li>\n</ul>\n"
},
{
"content": "<p>Event handler and async errors:</p>\n"
Expand Down
2 changes: 1 addition & 1 deletion public/generated/examples/GetErrorMessage.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"html": "<div><span class=\"tok-keyword\">import</span><span class=\"\"> </span><span class=\"tok-punctuation\">{</span><span class=\"\"> </span><span class=\"tok-variableName tok-definition\">getErrorMessage</span><span class=\"tok-punctuation\">,</span><span class=\"\"> </span><span class=\"tok-keyword\">type</span><span class=\"\"> </span><span class=\"tok-variableName tok-definition\">FallbackProps</span><span class=\"\"> </span><span class=\"tok-punctuation\">}</span><span class=\"\"> </span><span class=\"tok-keyword\">from</span><span class=\"\"> </span><span class=\"tok-string\">\"react-error-boundary\"</span><span class=\"tok-punctuation\">;</span><span class=\"\"></span></div>\n<div>&nbsp;</div>\n<div><span class=\"\"></span><span class=\"tok-keyword\">function</span><span class=\"\"> </span><span class=\"tok-variableName tok-definition\">Fallback</span><span class=\"tok-punctuation\">(</span><span class=\"tok-punctuation\">{</span><span class=\"\"> </span><span class=\"tok-propertyName\">error</span><span class=\"\"> </span><span class=\"tok-punctuation\">}</span><span class=\"tok-punctuation\">:</span><span class=\"\"> </span><span class=\"tok-typeName\">FallbackProps</span><span class=\"tok-punctuation\">)</span><span class=\"\"> </span><span class=\"tok-punctuation\">{</span><span class=\"\"></span></div>\n<div><span class=\"\"> </span><span class=\"tok-comment\">// Because 'error' can be anything, it's safest not to assume it's an Error</span><span class=\"\"></span></div>\n<div><span class=\"\"> </span><span class=\"tok-comment\">// Use the getErrorMessage helper method to extract the message instead.</span><span class=\"\"></span></div>\n<div><span class=\"\"> </span><span class=\"tok-keyword\">const</span><span class=\"\"> </span><span class=\"tok-variableName tok-definition\">message</span><span class=\"\"> </span><span class=\"tok-operator\">=</span><span class=\"\"> </span><span class=\"tok-variableName\">getErrorMessage</span><span class=\"tok-punctuation\">(</span><span class=\"tok-variableName\">error</span><span class=\"tok-punctuation\">)</span><span class=\"\"> </span><span class=\"tok-operator\">??</span><span class=\"\"> </span><span class=\"tok-string\">\"Unknown error\"</span><span class=\"tok-punctuation\">;</span><span class=\"\"></span></div>\n<div>&nbsp;</div>\n<div><span class=\"\"> </span><span class=\"tok-comment\">// Render fallback UI...</span><span class=\"\"></span></div>\n<div><span class=\"\"></span><span class=\"tok-punctuation\">}</span></div>"
"html": "<div><span class=\"tok-keyword\">import</span><span class=\"\"> </span><span class=\"tok-punctuation\">{</span><span class=\"\"> </span><span class=\"tok-variableName tok-definition\">getErrorMessage</span><span class=\"tok-punctuation\">,</span><span class=\"\"> </span><span class=\"tok-keyword\">type</span><span class=\"\"> </span><span class=\"tok-variableName tok-definition\">FallbackProps</span><span class=\"\"> </span><span class=\"tok-punctuation\">}</span><span class=\"\"> </span><span class=\"tok-keyword\">from</span><span class=\"\"> </span><span class=\"tok-string\">\"react-error-boundary\"</span><span class=\"tok-punctuation\">;</span><span class=\"\"></span></div>\n<div>&nbsp;</div>\n<div><span class=\"\"></span><span class=\"tok-keyword\">function</span><span class=\"\"> </span><span class=\"tok-variableName tok-definition\">Fallback</span><span class=\"tok-punctuation\">(</span><span class=\"tok-punctuation\">{</span><span class=\"\"> </span><span class=\"tok-propertyName\">error</span><span class=\"\"> </span><span class=\"tok-punctuation\">}</span><span class=\"tok-punctuation\">:</span><span class=\"\"> </span><span class=\"tok-typeName\">FallbackProps</span><span class=\"tok-punctuation\">)</span><span class=\"\"> </span><span class=\"tok-punctuation\">{</span><span class=\"\"></span></div>\n<div><span class=\"\"> </span><span class=\"tok-comment\">// Because 'error' can be anything, it's safest not to assume it's an Error.</span><span class=\"\"></span></div>\n<div><span class=\"\"> </span><span class=\"tok-comment\">// Use the getErrorMessage helper method to extract the message instead.</span><span class=\"\"></span></div>\n<div><span class=\"\"> </span><span class=\"tok-keyword\">const</span><span class=\"\"> </span><span class=\"tok-variableName tok-definition\">message</span><span class=\"\"> </span><span class=\"tok-operator\">=</span><span class=\"\"> </span><span class=\"tok-variableName\">getErrorMessage</span><span class=\"tok-punctuation\">(</span><span class=\"tok-variableName\">error</span><span class=\"tok-punctuation\">)</span><span class=\"\"> </span><span class=\"tok-operator\">??</span><span class=\"\"> </span><span class=\"tok-string\">\"Unknown error\"</span><span class=\"tok-punctuation\">;</span><span class=\"\"></span></div>\n<div>&nbsp;</div>\n<div><span class=\"\"> </span><span class=\"tok-comment\">// Render fallback UI...</span><span class=\"\"></span></div>\n<div><span class=\"\"></span><span class=\"tok-punctuation\">}</span></div>"
}
Loading
Loading