Skip to content

fix: capture full error cause stacks#444

Merged
SgtPooki merged 3 commits into
mainfrom
rvagg/error-cause-capture
Apr 10, 2026
Merged

fix: capture full error cause stacks#444
SgtPooki merged 3 commits into
mainfrom
rvagg/error-cause-capture

Conversation

@rvagg
Copy link
Copy Markdown
Contributor

@rvagg rvagg commented Apr 10, 2026

Synapse in particular uses wrapped errors with cause and they are being missed

Synapse in particular uses wrapped errors with cause and they are being missed
Copy link
Copy Markdown
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

This PR updates backend structured error logging to include nested Error.cause chains so wrapped errors (notably from Synapse) retain their underlying failure context in logs.

Changes:

  • Extend StructuredError with an optional cause field and recursively serialize Error.cause.
  • Add a recursion depth cap (MAX_CAUSE_DEPTH) to avoid unbounded nesting.
  • Add unit tests covering cause chain serialization and depth limiting.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
apps/backend/src/common/logging.ts Adds recursive cause serialization to structured errors with a max depth limit.
apps/backend/src/common/logging.spec.ts Adds tests validating cause chain serialization and recursion depth limiting.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread apps/backend/src/common/logging.ts
Comment thread apps/backend/src/common/logging.ts Outdated
@github-project-automation github-project-automation Bot moved this from 📌 Triage to ✔️ Approved by reviewer in FOC Apr 10, 2026
@SgtPooki SgtPooki merged commit a43610f into main Apr 10, 2026
7 checks passed
@SgtPooki SgtPooki deleted the rvagg/error-cause-capture branch April 10, 2026 18:19
@github-project-automation github-project-automation Bot moved this from ✔️ Approved by reviewer to 🎉 Done in FOC Apr 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🎉 Done

Development

Successfully merging this pull request may close these issues.

5 participants