-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: better DX for 500.astro in local development (#11244)
* wip * catch error in route.ts * catch error in route.ts * chore: tidy up error cases * log the original error * rebase * chore: reduce the scope of the 500 handling * we should not have a default 500 * remove props * remove unsure function, not needed * Update packages/astro/src/core/routing/astro-designed-error-pages.ts Co-authored-by: Florian Lefebvre <contact@florian-lefebvre.dev> * Update packages/astro/src/core/constants.ts Co-authored-by: Florian Lefebvre <contact@florian-lefebvre.dev> * changeset * relax the assertion * Update packages/astro/src/vite-plugin-astro-server/route.ts Co-authored-by: Florian Lefebvre <contact@florian-lefebvre.dev> * relax the assertion --------- Co-authored-by: Florian Lefebvre <contact@florian-lefebvre.dev>
- Loading branch information
1 parent
8036b9a
commit d07d2f7
Showing
12 changed files
with
163 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
'astro': patch | ||
--- | ||
|
||
Improves the developer experience of the custom `500.astro` page in development mode. | ||
|
||
Before, in development, an error thrown during the rendering phase would display the default error overlay, even when users had the `500.astro` page. | ||
|
||
Now, the development server will display the `500.astro` and the original error is logged in the console. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
packages/astro/test/fixtures/rewrite-runtime-error-custom500/astro.config.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { defineConfig } from 'astro/config'; | ||
|
||
// https://astro.build/config | ||
export default defineConfig({ | ||
experimental: { | ||
rewriting: true | ||
}, | ||
site: "https://example.com" | ||
}); |
8 changes: 8 additions & 0 deletions
8
packages/astro/test/fixtures/rewrite-runtime-error-custom500/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"name": "@test/rewrite-runtime-errror-custom500", | ||
"version": "0.0.0", | ||
"private": true, | ||
"dependencies": { | ||
"astro": "workspace:*" | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
packages/astro/test/fixtures/rewrite-runtime-error-custom500/src/pages/500.astro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
--- | ||
|
||
<h1>I am the custom 500</h1> |
3 changes: 3 additions & 0 deletions
3
packages/astro/test/fixtures/rewrite-runtime-error-custom500/src/pages/errors/start.astro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
return Astro.rewrite("/errors/throw") | ||
--- |
3 changes: 3 additions & 0 deletions
3
packages/astro/test/fixtures/rewrite-runtime-error-custom500/src/pages/errors/throw.astro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
throw new Error("Fancy error") | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.