mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-12 09:03:53 +00:00
9fc848567e
Co-authored-by: pooya parsa <pyapar@gmail.com> Co-authored-by: Clément Ollivier <clement.o2p@gmail.com> Co-authored-by: Anjorin Damilare <damilareanjorin1@gmail.com>
21 lines
520 B
Markdown
21 lines
520 B
Markdown
# `throwError`
|
|
|
|
Nuxt provides a quick and simple way to throw errows.
|
|
|
|
Within your pages, components and plugins you can use `throwError` to throw an error.
|
|
|
|
**Parameters:**
|
|
|
|
- `error`: `string | Error`
|
|
|
|
```js
|
|
throwError("😱 Oh no, an error has been thrown.")
|
|
```
|
|
|
|
The thrown error is set in state using [`useError()`](/api/composables/useError) to create a reactive and SSR-friendly shared error state across components.
|
|
|
|
`throwError` calls the `app:error` hook.
|
|
|
|
::ReadMore{link="/guide/features/error-handling"}
|
|
::
|