Nuxt/docs/content/3.api/2.components/5.nuxt-error-boundary.md
Clément Ollivier c7ff6d1740
chores(docs): prevent link rendering by Docus (#4166)
Use back ticks to prevent Docus from rendering a link to Github based on `@` character
2022-04-07 16:02:54 +02:00

835 B

<NuxtErrorBoundary>

Nuxt provides the <NuxtErrorBoundary> component to handle 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 occured: {{ error }}</p>
          </template>
        </NuxtErrorBoundary>
      </template>
    

::ReadMore{link="/guide/features/error-handling"} ::