-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: add
useError
composable (#8912)
- Loading branch information
Showing
1 changed file
with
27 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,37 @@ | ||
--- | ||
title: "useError" | ||
description: useError composable returns the global Nuxt error that is being handled. | ||
--- | ||
|
||
# `useError` | ||
|
||
This function will return the global Nuxt error that is being handled. | ||
`useError` composable returns the global Nuxt error that is being handled and it is available on both client and server. | ||
|
||
```ts | ||
const error = useError() | ||
``` | ||
|
||
`useError` sets an error in the state and creates a reactive and SSR-friendly global Nuxt error across components. | ||
`useError` sets an error in the state and creates a reactive as well as SSR-friendly global Nuxt error across components. Nuxt errors have the following properties: | ||
|
||
## Properties | ||
|
||
- **statusCode** | ||
|
||
Type: `Number` | ||
|
||
HTTP response status code | ||
|
||
- **statusMessage** | ||
|
||
Type: `String` | ||
|
||
HTTP response status message | ||
|
||
- **message** | ||
|
||
Type: `String` | ||
|
||
Error message | ||
|
||
::ReadMore{link="/docs/getting-started/error-handling"} | ||
:: |