Skip to content

Conversation

@HugoRCD
Copy link
Owner

@HugoRCD HugoRCD commented Feb 2, 2026

Resolves #24

This pull request updates the EvlogError class 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.

@HugoRCD HugoRCD self-assigned this Feb 2, 2026
@HugoRCD HugoRCD requested a review from Copilot February 2, 2026 12:55
@vercel
Copy link

vercel bot commented Feb 2, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
evlog-docs Ready Ready Preview, Comment Feb 3, 2026 0:02am

@github-actions github-actions bot added the bug Something isn't working label Feb 2, 2026
@github-actions
Copy link

github-actions bot commented Feb 2, 2026

Thank you for following the naming conventions! 🙏

@HugoRCD HugoRCD changed the title fix: createError data lost in production fix: createError data lost in production Feb 2, 2026
@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 2, 2026

npm i https://pkg.pr.new/evlog@29

commit: 116c96f

@HugoRCD
Copy link
Owner Author

HugoRCD commented Feb 2, 2026

@NicolaSpadari, can you try to see if this version fixes the problem "evlog": "https://pkg.pr.new/evlog@29" ?

Copy link
Contributor

Copilot AI left a 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 dedicated data object for consistent serialization.
  • Update parseError and 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.

@NicolaSpadari
Copy link

NicolaSpadari commented Feb 2, 2026

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.
Then build it and preview it, try again to click button and see the network response

"message" still comes through, "why" doesn't

@HugoRCD
Copy link
Owner Author

HugoRCD commented Feb 3, 2026

@NicolaSpadari And this time? with https://pkg.pr.new/evlog@116c96f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] createEvlogError throws unhandled error in production

3 participants