Nuxt/docs/content/3.api/3.utils/clear-error.md
Yaël Guilloux dc47c64f14
docs: use nuxt 3 and website theme (#5479)
Co-authored-by: Daniel Roe <daniel@roe.dev>
Co-authored-by: Sébastien Chopin <seb@nuxtjs.com>
Co-authored-by: Pooya Parsa <pooya@pi0.io>
Co-authored-by: pooya parsa <pyapar@gmail.com>
Co-authored-by: Clément Ollivier <clement.o2p@gmail.com>
2022-10-06 11:15:30 +02:00

731 B

title description
clearError The clearError composable clears all handled errors.

clearError

Within your pages, components, and plugins, you can use clearError to clear all errors and redirect the user.

Parameters:

  • options?: { redirect?: string }

You can provide an optional path to redirect to (for example, if you want to navigate to a 'safe' page).

// Without redirect
clearError()

// With redirect
clearError({ redirect: '/homepage' })

Errors are set in state using useError(). The clearError composable will reset this state and calls the app:error:cleared hook with the provided options.

::ReadMore{link="/getting-started/error-handling"} ::