-
Notifications
You must be signed in to change notification settings - Fork 27.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
ENOENT
error in renderToHTML
should pass err
to error page
#5625
Comments
ENOENT
error in renderToHTML
should pass err
to error page
I have added a errorCodeMapper, the fork is here: https://github.com/timbielawski/next.js/tree/add/custom-error-handler commit: I want to see what the feeling is and then I will do a PR
Currently Nextjs will render a 500 for any error thrown in the rendered app In my app I add the error code mapper Then I can map any error that my app throws to a http code so the correct error is returned from Nextjs
|
I'm going to close this as this has been open for a year and there hasn't been a contribution to solve it. It would require a relatively large refactor of how the server implementation works so I don't feel like it's worth exploring rewriting it just for this specific case. |
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
See also
renderScriptError
The
ENOENT
check should be replaced by a named error. Its not always going to be a 404. Sometimes it might be a bug, and we need the stack trace to work out what is going on - like in After the initial render, any direct url visits to pages result in 404s #5620. If a page doesn't exist, the error would be throw far away inrenderToHTML > doRender > requirePage > getPagePath
.There should be a better check for a 404 vs. other ENOENTs.
We should always return the error for 404s.
return this.renderErrorToHTML(null, req, res, pathname, query)
.Silencing errors is bad. How to handle a 404 should be taken care of inside
renderErrorToHTML
err
should be made available outside of server-siderenderToHTML
.See #3452.
The text was updated successfully, but these errors were encountered: