Skip to content

feat: add toJSON serialization to RuntimeError (Issue #155) - #206

Open
rafaio1 wants to merge 1 commit into
Lilly-Protocol:mainfrom
rafaio1:bounty/issue-155-tojson-runtime-error
Open

feat: add toJSON serialization to RuntimeError (Issue #155)#206
rafaio1 wants to merge 1 commit into
Lilly-Protocol:mainfrom
rafaio1:bounty/issue-155-tojson-runtime-error

Conversation

@rafaio1

@rafaio1 rafaio1 commented Aug 26, 2026

Copy link
Copy Markdown

Summary

Adds toJSON() method to RuntimeError so that code, details, and stack survive JSON.stringify for lossless logging and API serialization.

Changes

  • ✅ Added toJSON() returning { name, code, message, details, stack }
  • ✅ All fields preserved through JSON round-trip
  • ✅ Stack trace included in serialized output

Tests Added

  • code and details present in JSON.stringify output
  • ✅ Stack trace included in toJSON() result
  • ✅ Undefined details handled correctly
  • ✅ Full round-trip preservation verified

Verification

All 4 tests pass locally via npx vitest run tests/errors/runtime-error-tojson.test.ts.

Closes #155

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bounty: $25] Add toJSON serialization to RuntimeError

1 participant