Skip to content

fix: better DX for 500.astro in local development#11244

Merged
ematipico merged 16 commits intomainfrom
fix/rewriting-and-500
Jun 13, 2024
Merged

fix: better DX for 500.astro in local development#11244
ematipico merged 16 commits intomainfrom
fix/rewriting-and-500

Conversation

@ematipico
Copy link
Copy Markdown
Member

Changes

This PR enhance the usage of the 500.astro page when rewriting.

Before, in dev mode, we were not even displaying the custom 500.astro, probably because we wanted to show the original error. However, this was causing more issues when using the rewriting, because users needed to rewrite using the 500.astro, and see the results.

This PR catches the error in dev mode, and renders the custom 500 if present. I also logs the original error, because that won't be visible in the default 500.astro

Closes #11208

Testing

Added new test cases to test the custom 500.astro and the default 500 page (none)

Docs

N/A

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Jun 12, 2024

🦋 Changeset detected

Latest commit: 10c0491

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label Jun 12, 2024
@ematipico ematipico force-pushed the fix/rewriting-and-500 branch from eb322ce to f73f190 Compare June 12, 2024 13:43
Copy link
Copy Markdown
Member

@florian-lefebvre florian-lefebvre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need a changeset for this?

ematipico and others added 3 commits June 12, 2024 16:43
Co-authored-by: Florian Lefebvre <contact@florian-lefebvre.dev>
Co-authored-by: Florian Lefebvre <contact@florian-lefebvre.dev>
@florian-lefebvre
Copy link
Copy Markdown
Member

Related docs PR withastro/docs#8495

ematipico and others added 2 commits June 12, 2024 17:00
Co-authored-by: Florian Lefebvre <contact@florian-lefebvre.dev>
Copy link
Copy Markdown
Member

@florian-lefebvre florian-lefebvre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Don't forget to update the PR I linked, specifically the part about enabling in development

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg: astro Related to the core `astro` package (scope)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Experimental rewrite: Response with status:500 does not trigger 500.astro in production

2 participants