Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

Commit

Permalink
docs: add explicit createError import (#6050)
Browse files Browse the repository at this point in the history
Co-authored-by: Pooya Parsa <pooya@pi0.io>
  • Loading branch information
mtskf and pi0 committed Jul 22, 2022
1 parent 147ba56 commit 38158cf
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
6 changes: 4 additions & 2 deletions docs/components/atoms/StabilityEdge.vue
Original file line number Diff line number Diff line change
@@ -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>

Expand Down
8 changes: 8 additions & 0 deletions docs/content/2.guide/2.features/7.error-handling.md
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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`.
Expand Down
4 changes: 4 additions & 0 deletions docs/content/3.api/3.utils/create-error.md
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 38158cf

Please sign in to comment.