Nuxt/docs/3.api/2.components/6.nuxt-error-boundary.md
Sébastien Chopin 3ec108493d
docs: simplify the docs directory (#18506)
* docs: simplify docs to only markdown

* Create nuxt-config.md

* chore: update

* chore: add readme
2023-01-25 10:41:41 +01:00

969 B

title description
<NuxtErrorBoundary> The <NuxtErrorBoundary> component handles client-side errors happening in its default slot.

<NuxtErrorBoundary>

The <NuxtErrorBoundary> component handles client-side errors happening in its default slot, using Vue's onErrorCaptured hook.

Events

  • @error: Event emitted when the default slot of the component throws an error.

    <template>
      <NuxtErrorBoundary @error="logSomeError">
        <!-- ... -->
      </NuxtErrorBoundary>
    </template>
    

Slots

  • #error: Specify a fallback content to display in case of error.

      <template>
        <NuxtErrorBoundary>
          <!-- ... -->
          <template #error="{ error }">
            <p>An error occurred: {{ error }}</p>
          </template>
        </NuxtErrorBoundary>
      </template>
    

::ReadMore{link="/docs/getting-started/error-handling"} ::