2022-03-11 08:22:16 +00:00
|
|
|
<script setup lang="ts">
|
2022-07-21 14:29:03 +00:00
|
|
|
import { showError } from '#app'
|
2022-03-11 08:22:16 +00:00
|
|
|
const route = useRoute()
|
|
|
|
if ('setup' in route.query) {
|
|
|
|
throw new Error('error in setup')
|
|
|
|
}
|
|
|
|
if ('mounted' in route.query) {
|
|
|
|
onMounted(() => {
|
|
|
|
throw new Error('error in mounted')
|
|
|
|
})
|
|
|
|
}
|
|
|
|
function triggerError () {
|
|
|
|
throw new Error('manually triggered error')
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2022-03-31 13:31:04 +00:00
|
|
|
<NuxtExampleLayout example="app/error-handling">
|
2022-03-11 08:22:16 +00:00
|
|
|
<template #nav>
|
|
|
|
<nav class="flex align-center gap-4 p-4">
|
|
|
|
<NuxtLink to="/" class="n-link-base">
|
|
|
|
Home
|
|
|
|
</NuxtLink>
|
2022-03-16 15:49:53 +00:00
|
|
|
<NuxtLink to="/other" class="n-link-base">
|
|
|
|
Other
|
|
|
|
</NuxtLink>
|
2022-03-11 08:22:16 +00:00
|
|
|
<NuxtLink to="/404" class="n-link-base">
|
|
|
|
404
|
|
|
|
</NuxtLink>
|
|
|
|
<NuxtLink to="/?middleware" class="n-link-base">
|
|
|
|
Middleware
|
|
|
|
</NuxtLink>
|
2022-07-21 14:29:03 +00:00
|
|
|
<button class="n-link-base" @click="showError">
|
2022-03-11 08:22:16 +00:00
|
|
|
Trigger fatal error
|
|
|
|
</button>
|
|
|
|
<button class="n-link-base" @click="triggerError">
|
|
|
|
Trigger non-fatal error
|
|
|
|
</button>
|
|
|
|
</nav>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<template #footer>
|
|
|
|
<div class="text-center p-4 op-50">
|
|
|
|
Current route: <code>{{ route.path }}</code>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</NuxtExampleLayout>
|
|
|
|
</template>
|