mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 21:55:11 +00:00
docs: add explicit createError
import (#6050)
Co-authored-by: Pooya Parsa <pooya@pi0.io>
This commit is contained in:
parent
147ba56f6b
commit
38158cf261
@ -1,8 +1,10 @@
|
||||
<template>
|
||||
<Alert icon="🧪">
|
||||
{{ title }} is available on edge channel. Check out the <Link to="/guide/going-further/edge-channel">
|
||||
Edge Channel Documentation
|
||||
{{ title }} is available on edge channel. Check out the
|
||||
<Link to="/guide/going-further/edge-channel">
|
||||
Edge Channel Documentation
|
||||
</Link> to beta test.
|
||||
<slot />
|
||||
</Alert>
|
||||
</template>
|
||||
|
||||
|
@ -93,6 +93,10 @@ If you throw an error created with `createError`:
|
||||
|
||||
### Example
|
||||
|
||||
::StabilityEdge{title="Auto import of createError"}
|
||||
In the current version, add `import { createError } from 'h3'` in order to use `createError`.
|
||||
::
|
||||
|
||||
```vue [pages/movies/[slug].vue]
|
||||
<script setup>
|
||||
const route = useRoute()
|
||||
@ -105,6 +109,10 @@ if (!data.value) {
|
||||
|
||||
### `showError`
|
||||
|
||||
::StabilityEdge{title="showError"}
|
||||
In the current version, use `throwError` or `throw createError` instead.
|
||||
::
|
||||
|
||||
* `function showError (err: string | Error | { statusCode, statusMessage }): Error`
|
||||
|
||||
You can call this function at any point on client-side, or (on server side) directly within middleware, plugins or `setup()` functions. It will trigger a full-screen error page which you can clear with `clearError`.
|
||||
|
@ -15,6 +15,10 @@ If you throw an error created with `createError`:
|
||||
|
||||
### Example
|
||||
|
||||
::StabilityEdge{title="Auto import of createError"}
|
||||
In the current version, add `import { createError } from 'h3'` in order to use `createError`.
|
||||
::
|
||||
|
||||
```vue [pages/movies/[slug].vue]
|
||||
<script setup>
|
||||
const route = useRoute()
|
||||
|
Loading…
Reference in New Issue
Block a user