2023-10-18 10:59:43 +00:00
---
title: 'showError'
description: Nuxt provides a quick and simple way to show a full screen error page if needed.
links:
- label: Source
icon: i-simple-icons-github
to: https://github.com/nuxt/nuxt/blob/main/packages/nuxt/src/app/composables/error.ts
size: xs
---
2022-07-21 14:29:03 +00:00
2024-01-31 09:46:21 +00:00
Within the [Nuxt context ](/docs/guide/going-further/nuxt-app#the-nuxt-context ) you can use `showError` to show an error.
2022-07-21 14:29:03 +00:00
**Parameters:**
- `error` : `string | Error | Partial<{ cause, data, message, name, stack, statusCode, statusMessage }>`
2023-10-18 10:59:43 +00:00
```ts
2022-07-21 14:29:03 +00:00
showError("😱 Oh no, an error has been thrown.")
2023-10-18 10:59:43 +00:00
showError({
statusCode: 404,
statusMessage: "Page Not Found"
})
2022-07-21 14:29:03 +00:00
```
2022-11-16 10:04:28 +00:00
The error is set in the state using [`useError()` ](/docs/api/composables/use-error ) to create a reactive and SSR-friendly shared error state across components.
2022-07-21 14:29:03 +00:00
2024-02-21 17:09:45 +00:00
::tip
2024-07-12 21:00:13 +00:00
`showError` calls the `app:error` hook client-side.
2022-07-21 14:29:03 +00:00
::
2023-10-18 10:59:43 +00:00
:read-more{to="/docs/getting-started/error-handling"}