mirror of https://github.com/nuxt/nuxt.git
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>
|
<template>
|
||||||
<Alert icon="🧪">
|
<Alert icon="🧪">
|
||||||
{{ title }} is available on edge channel. Check out the <Link to="/guide/going-further/edge-channel">
|
{{ title }} is available on edge channel. Check out the
|
||||||
Edge Channel Documentation
|
<Link to="/guide/going-further/edge-channel">
|
||||||
|
Edge Channel Documentation
|
||||||
</Link> to beta test.
|
</Link> to beta test.
|
||||||
|
<slot />
|
||||||
</Alert>
|
</Alert>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
|
@ -93,6 +93,10 @@ If you throw an error created with `createError`:
|
||||||
|
|
||||||
### Example
|
### 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]
|
```vue [pages/movies/[slug].vue]
|
||||||
<script setup>
|
<script setup>
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
|
@ -105,6 +109,10 @@ if (!data.value) {
|
||||||
|
|
||||||
### `showError`
|
### `showError`
|
||||||
|
|
||||||
|
::StabilityEdge{title="showError"}
|
||||||
|
In the current version, use `throwError` or `throw createError` instead.
|
||||||
|
::
|
||||||
|
|
||||||
* `function showError (err: string | Error | { statusCode, statusMessage }): Error`
|
* `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`.
|
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
|
### 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]
|
```vue [pages/movies/[slug].vue]
|
||||||
<script setup>
|
<script setup>
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
|
|
Loading…
Reference in New Issue