mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 06:05:11 +00:00
c7ff6d1740
Use back ticks to prevent Docus from rendering a link to Github based on `@` character
34 lines
835 B
Markdown
34 lines
835 B
Markdown
# `<NuxtErrorBoundary>`
|
|
|
|
Nuxt provides the `<NuxtErrorBoundary>` component to handle client-side errors happening in its default slot, using Vue's [`onErrorCaptured` hook.](https://vuejs.org/api/composition-api-lifecycle.html#onerrorcaptured)
|
|
|
|
## Events
|
|
|
|
- **`@error`**: Event emitted when the default slot of the component throws an error.
|
|
|
|
```vue
|
|
<template>
|
|
<NuxtErrorBoundary @error="logSomeError">
|
|
<!-- ... -->
|
|
</NuxtErrorBoundary>
|
|
</template>
|
|
```
|
|
|
|
## Slots
|
|
|
|
- **#error**: Specify a fallback content to display in case of error.
|
|
|
|
```vue
|
|
<template>
|
|
<NuxtErrorBoundary>
|
|
<!-- ... -->
|
|
<template #error="{ error }">
|
|
<p>An error occured: {{ error }}</p>
|
|
</template>
|
|
</NuxtErrorBoundary>
|
|
</template>
|
|
```
|
|
|
|
::ReadMore{link="/guide/features/error-handling"}
|
|
::
|