Skip to content

Fix: Replace Object.assign with safe Error subclass in error-report r…#833

Merged
RUKAYAT-CODER merged 1 commit into
rinafcode:mainfrom
xtrial01:fix/error-reconstruction-strict-mode
Jun 29, 2026
Merged

Fix: Replace Object.assign with safe Error subclass in error-report r…#833
RUKAYAT-CODER merged 1 commit into
rinafcode:mainfrom
xtrial01:fix/error-reconstruction-strict-mode

Conversation

@xtrial01

Copy link
Copy Markdown

Summary

Fixes #714 - Replaced Object.assign(new Error(), {...}) with a safe ClientError subclass in the error-report route.

Changes

  • Created ClientError class that extends Error and sets the name property in the constructor
  • Avoids strict mode violations when mutating non-writable native Error properties
  • Ensures instanceof Error checks work correctly on reconstructed objects
  • PII scrubbing is already handled by the existing logging library's redaction system

Acceptance Criteria

  • ✅ Error reconstruction does not throw in strict mode
  • ✅ The reconstructed object passes instanceof Error
  • ✅ No writable-property violations occur

…oute (rinafcode#714)

- Replace Object.assign(new Error(), {...}) with ClientError subclass
- Avoids strict mode violations when mutating non-writable Error properties
- Ensures instanceof Error checks work correctly on reconstructed objects
- PII scrubbing handled by existing logging library redaction
@drips-wave

drips-wave Bot commented Jun 29, 2026

Copy link
Copy Markdown

@xtrial01 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@RUKAYAT-CODER

Copy link
Copy Markdown
Contributor

Thank you for contributing to the project.

@RUKAYAT-CODER RUKAYAT-CODER merged commit caffae0 into rinafcode:main Jun 29, 2026
4 checks passed
@xtrial01

Copy link
Copy Markdown
Author

thanks for giving the opportunity

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.

[Bug] Object.assign(new Error()) mutation in error-report route can fail in strict mode

2 participants