Skip to content
Open
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { setComponentTemplate } from '@glimmer/manager/lib/public/template';
import { templateOnlyComponent } from '@glimmer/runtime/lib/component/template-only';

import ErrorBoundaryTemplate from '../templates/error-boundary';

/**
* A template-only `<ErrorBoundary>` whose layout is a single `{{#try}}`. Its
* `<:try>` and `<:catch>` are named blocks, so unlike the keyword's clauses
* they can be written in either order.
*/
const ErrorBoundary = setComponentTemplate(
ErrorBoundaryTemplate,
templateOnlyComponent(
'packages/@ember/-internals/glimmer/lib/components/error-boundary',
'ErrorBoundary'
)
);

export default ErrorBoundary;
17 changes: 17 additions & 0 deletions packages/@ember/-internals/glimmer/lib/templates/error-boundary.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { precompileTemplate } from '@ember/template-compilation';

/**
* The whole of `<ErrorBoundary>`: a `{{#try}}` that yields to the `<:try>` and
* `<:catch>` blocks. A boundary with no fallback uses `{{#try}}` directly, so
* there is no default-block form.
*/
export default precompileTemplate(
`{{#try}}{{yield to="try"}}{{catch as |error retry|}}{{yield error retry to="catch"}}{{/try}}`,
{
moduleName: 'packages/@ember/-internals/glimmer/lib/templates/error-boundary.hbs',
strictMode: true,
scope() {
return {};
},
}
);
Loading
Loading