Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR improves request error handlers with different implementations for development and production.
Followup:
youch-core
as an opt-in featureErrors in development
Using poppinss/youch 4.x for HTML rendering: (only if
accept
header explicitly includestext/html
~ browsers)Note
Sourcemaps for the app are automatically applied, without the need of
NODE_OPTIONS="--enable-source-maps"
.JSON responses (when the accept header does not include
text/html
) are consistent with production errors and have more useful fields:For console errors (for unhandled or fatal errors) use consola + Youch.toANSI and include more info including method, URL, cause and source 🔥
Worker entry errors are now also improved by leveraging the same dev error handler:
Errors in production
Nitro errors in production are always JSON with
application/json
mime:Server console errors include request info, and error data + cause (if any) using native runtime
console.error
handler for formatting:Note
In production,
NODE_OPTIONS="--enable-source-maps"
is required in order to enable sourcemaps.