~/components
<!-- - showError() is a Nuxt function already available via auto-import. - Docs: https://nuxt.com/docs/getting-started/error-handling#showerror--><NuxtErrorBoundary @error="showError"> <slot /></NuxtErrorBoundary>
error.vue
app.vue
<script setup lang="ts">import type { NuxtError } from '#app';import DashboardLayout from '~/layouts/dashboard.vue';import AuthLayout from '~/layouts/auth.vue';import DefaultLayout from '~/layouts/default.vue';import { BonfoPageError } from '~/components/_bonfo';const props = defineProps({ error: Object as () => NuxtError,});console.dir(props.error);const route = useRoute();const Layout = computed(() => { switch (route.meta.layout) { case 'dashboard': return DashboardLayout; case 'auth': return AuthLayout; default: return DefaultLayout; }});</script><template> <Layout> <BonfoPageError title="Oops 😬, that was unexpected." description="An error occurred while trying to load this page. You can trust that we are working hard to fix it." /> </Layout></template>
NuxtErrorBoundary