2022-04-06 05:56:08 +00:00
# `clearError`
2022-04-11 21:00:43 +00:00
Nuxt provides a composable to clear all handled errors.
Within your pages, components, and plugins, you can use `clearError` to clear all errors and redirect the user.
**Parameters:**
2022-04-14 08:51:39 +00:00
- `options?: { redirect?: string }`
2022-04-06 05:56:08 +00:00
2022-04-11 21:00:43 +00:00
You can provide an optional path to redirect to (for example, if you want to navigate to a 'safe' page).
```js
// Without redirect
clearError()
// With redirect
2022-04-14 08:51:39 +00:00
clearError({ redirect: '/homepage' })
2022-04-11 21:00:43 +00:00
```
2022-04-14 08:53:58 +00:00
Errors are set in state using [`useError()` ](/api/composables/use-error ). The `clearError` composable will reset this state and calls the `app:error:cleared` hook with the provided options.
2022-04-11 21:00:43 +00:00
::ReadMore{link="/guide/features/error-handling"}
2022-04-06 05:56:08 +00:00
::