Installation
Requirements
| Environment | Minimum version |
|---|---|
| Vue | 3.4.0+ |
| Node.js | ^20.19.0 or >=22.12.0 |
@nuxt/kit | 3.0.0+ (optional — only for the /nuxt module) |
vue-router | 4.0.0+ (optional — only for the /router integration) |
@tanstack/vue-query | 5.0.0+ (optional — only for the /tanstack-query integration) |
Installation
bash
npm install vue-error-boundary-kitQuick start
vue
<script setup lang="ts">
import { ErrorBoundary } from 'vue-error-boundary-kit'
import UserProfile from './UserProfile.vue'
const userId = ref('42')
const routeId = ref('profile')
function handleError(error) {
// error: CapturedError — see Types below
}
</script>
<template>
<ErrorBoundary :reset-keys="[routeId]" @error="handleError">
<template #default>
<UserProfile :id="userId" />
</template>
<template #fallback="{ error, reset, retryCount }">
<ErrorState :message="error.message" @retry="reset" />
</template>
</ErrorBoundary>
</template>