2022-10-06 09:15:30 +00:00
---
title: "clearError"
description: "The clearError composable clears all handled errors."
---
2022-04-06 05:56:08 +00:00
2022-10-06 09:15:30 +00:00
# `clearError`
2022-04-11 21:00:43 +00:00
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
2022-09-13 12:54:31 +00:00
::ReadMore{link="/getting-started/error-handling"}
2022-04-06 05:56:08 +00:00
::