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

docs: add explicit createError import #6050

Merged
merged 2 commits into from
Jul 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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