docs: add explicit `createError` import (#6050)

Co-authored-by: Pooya Parsa <pooya@pi0.io>
This commit is contained in:
Mitsuki Fukunaga 2022-07-22 17:55:54 +10:00 committed by GitHub
parent 147ba56f6b
commit 38158cf261
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 2 deletions

View File

@ -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>

View File

@ -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`.

View File

@ -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()