diff --git a/text/0000-error-boundary.md b/text/0000-error-boundary.md new file mode 100644 index 0000000000..c737998850 --- /dev/null +++ b/text/0000-error-boundary.md @@ -0,0 +1,403 @@ +--- +stage: accepted +start-date: 2026-09-09T00:00:00.000Z +release-date: # In format YYYY-MM-DDT00:00:00.000Z +release-versions: +teams: + - framework +prs: + accepted: # Fill this in with the URL for the Proposal RFC PR +project-link: +suite: +--- + +# Error boundaries + +## Summary + +Give Ember a way to contain a render error instead of letting it take down the page. A boundary catches synchronous errors thrown during Glimmer VM render, on both initial render and rerender, shows fallback content in their place, and can recover afterwards. The proposed surface is a built-in `` component, with a `<:try>` block for the happy path and a `<:catch>` block for the fallback. Recovery comes from the reactivity system: a boundary retries when tracked state read by the failed render changes, and the fallback also gets a `retry` function for errors tracking can't see. The component is the shape suggested here, not the point of the proposal. [Alternatives](#alternatives) compares it with a block keyword, and the choice between them is still open. + +## Motivation + +Today, when a component throws during render, the error propagates up uncaught and can leave the page in a broken or unresponsive state. There's no declarative mechanism to catch these errors, display fallback UI, or recover without a full page reload. This is a significant gap in Ember's component model. + +```gjs +import Component from '@glimmer/component'; + +class BuggyWidget extends Component { + get title() { + return this.args.data.title; // throws if @data is undefined + } + + +} + + +``` + +In this example, `BuggyWidget` throws because `@data` was not passed. But the failure isn't isolated to the widget. The entire page, including `
`, ``, and `