-
-
Notifications
You must be signed in to change notification settings - Fork 7
fix: createError data lost in production
#29
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
base: main
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Thank you for following the naming conventions! 🙏 |
createError data lost in production
commit: |
|
@NicolaSpadari, can you try to see if this version fixes the problem |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Improves EvlogError serialization/shape to preserve structured error data across Nitro/H3 versions (v2/v1 vs v3/v2), addressing production cases where custom error data was being dropped.
Changes:
- Add Nitro v3+/H3 v2+ compatible fields (
status,statusText) while keeping legacy (statusCode,statusMessage) as deprecated. - Move structured error context (
why/fix/link) into a dedicateddataobject for consistent serialization. - Update
parseErrorand tests to recognize both Nitro/H3 generations’ status/message fields.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/evlog/src/error.ts | Extends EvlogError with status/statusText + legacy fields and serializes structured context under data. |
| packages/evlog/src/runtime/utils/parseError.ts | Parses both Nitro v3+/v2 error response shapes for status and message fields. |
| packages/evlog/test/error.test.ts | Updates/extends tests to cover the new status fields and the new JSON shape (data). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Thank you for the quick check. Unfortunately, still seems to occur, and the "why" key gets lost after build. I created a reproduction here https://github.com/NicolaSpadari/evlog-data-reproduction Just try to run it as dev, click the button, see the network response. "message" still comes through, "why" doesn't |
|
@NicolaSpadari And this time? with https://pkg.pr.new/evlog@116c96f |
Resolves #24
This pull request updates the
EvlogErrorclass and related utilities to improve compatibility across different versions of Nitro/H3, enhance structured error data, and modernize the API.The main changes introduce new status and message properties, deprecate legacy ones, and ensure consistent error serialization and parsing.