0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-02-17 22:44:24 -05:00
astro/.changeset/rich-dolls-compete.md
Florian Lefebvre 9042be0491
feat: 500.astro improvements (#11134)
* feat: better error handling

* feat: allow passing props to render context render

* feat: work on tests

* Update 500.astro

* feat: test preview custom 500

* feat: test for custom 500 failing

* feat: add changeset

* Update rich-dolls-compete.md

* Delete packages/astro/e2e/custom-500.test.js

* Apply suggestions from code review

Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>

* fix: merge

* Update packages/astro/test/custom-500.test.js

Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>

* Apply suggestions from code review

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>

* Update packages/astro/src/core/app/index.ts

* feat: update

---------

Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
Co-authored-by: Matthew Phillips <matthew@skypack.dev>
2024-06-19 10:00:16 -04:00

691 B

astro
minor

Improves the developer experience of the 500.astro file by passing it a new error prop.

When an error is thrown, the special src/pages/500.astro page now automatically receives the error as a prop. This allows you to display more specific information about the error on a custom 500 page.

---
// src/pages/500.astro
interface Props {
    error: unknown
}

const { error } = Astro.props
---

<div>{error instanceof Error ? error.message : 'Unknown error'}</div>

If an error occurs rendering this page, your host's default 500 error page will be shown to your visitor in production, and Astro's default error overlay will be shown in development.