Skip to content

Add wrap option for deserialized errors#117

Closed
Develop-KIM wants to merge 1 commit into
sindresorhus:mainfrom
Develop-KIM:agent/add-deserialize-wrap-option
Closed

Add wrap option for deserialized errors#117
Develop-KIM wants to merge 1 commit into
sindresorhus:mainfrom
Develop-KIM:agent/add-deserialize-wrap-option

Conversation

@Develop-KIM

Copy link
Copy Markdown

Fixes #98

Summary

  • Add a wrap option to deserializeError that returns a new error with the deserialized error set as cause.
  • Preserve the resolved error constructor for the wrapper and capture a current stack when Error.captureStackTrace is available.
  • Document the option and cover runtime and type tests.

Verification

  • npm test
  • git diff --check

Disclosure

This contribution was prepared with AI assistance and reviewed before submission.

Co-Authored-By: OpenAI <noreply@openai.com>
@Develop-KIM
Develop-KIM marked this pull request as ready for review July 9, 2026 16:01
@sindresorhus

Copy link
Copy Markdown
Owner

#118 (comment)

Repository owner locked as resolved and limited conversation to collaborators Jul 9, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Optionally preserve current stack

2 participants