-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expertimental rewrite: when target page throws an error, this results in "404 Not Found" #11110
Comments
I suppose you're interested at the error only in dev mode, correct? |
For more context: nicer error handling was my goal of using the rewrite feature, actually. I want the home page to show different views for two types of users that I have. Previously I conditionally included two components, which had a downside: any error in the component would be handled only in the middle of the response. This doesn’t happen with rewrites, but the DX is suboptimal. |
For the developer tools, yes, I only expect them in dev mode. For the error type… 404 Not Found would be quite misleading in production, I believe. It would be nice to propagate the original status somehow, maybe even the whole response. |
The |
Thank you for taking time to respond, however I fail to apply this to the situation I have described. Astro has definitely found a route that corresponds to the response. Route has generated an error, however. There is an error to render, but instead a 404 is rendered by the rewrite internals. When I comment out the error generation in the route, the route non-error response is rendered. |
Perfect, thank you. I will think about what's best away to handle this use case. |
Astro Info
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
I tried using rewrites for an existing page and they work fine! However sometimes this existing page throws an error, and this case is not handled well.
Without rewrite, Astro developer tools show a nice UI for exceptions thrown in the standalone Node backend.
With rewrite, this doesn’t happen. First of all, any kind of error results in a 404 Not Found message. Second, this is not handled by Astro developer tools, so after followup changes I need to manually reload the page to see results.
What's the expected result?
Astro developer tools should handle the exception. The original exception should be shown, not "Not Found".
Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-h5n839?file=src%2Fpages%2Findex.astro
Participation
The text was updated successfully, but these errors were encountered: