Nuxe provides a first-class error system built around a singleDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/dvlkit/nuxe/llms.txt
Use this file to discover all available pages before exploring further.
NuxeError class. Whether an error originates in a server API route, a middleware guard, or deep inside a Vue component, the same primitives — createError, showError, useError, and clearError — let you surface and dismiss it consistently across SSR and client-side navigation.
NuxeError
NuxeError extends the native Error class with HTTP-oriented fields that map naturally to server responses and UI display:
createError(payload)
createError is the factory for NuxeError. It accepts three input shapes so you can create errors without always constructing the full payload object:
showError(err)
Call showError inside a Vue component to both update the app’s error state (triggering app/error.vue) and throw the error so component execution stops:
showError accepts the same input shapes as createError — a NuxeErrorPayload object, a plain string, or a native Error.
useError()
useError returns a reactive Ref<NuxeError | null> that reflects the current error state. It is null when no error is active.
clearError(options?)
Call clearError to dismiss the current error and optionally redirect the user to a different route. Typically invoked from a button in app/error.vue.
A route path to push via Vue Router after clearing the error. The navigation happens after
error.value is set to null.isNuxeError(err)
A TypeScript type guard that returns true when err is a NuxeError instance (or a plain object shaped like one, which can occur after SSR deserialisation):
serializeError / deserializeError
Nuxe serialises errors into the SSR payload so the client can hydrate the exact same error state. You rarely call these directly, but they are available when building custom server rendering utilities:
Custom app/error.vue
When any error is active, Nuxe unmounts the normal page tree and renders app/error.vue instead. The component receives the current NuxeError as the error prop.
The playground’s app/error.vue shows a clean example — displaying the status code and message, setting the page title, and providing a “Go home” link that calls clearError:
Create app/error.vue
Add an
app/error.vue file to your project. Nuxe detects it automatically — no registration required.Accept the error prop
Declare
defineProps<{ error: NuxeError }>() to receive the active error with full TypeScript types.Display status information
Render
error.statusCode and error.statusMessage so users understand what went wrong.