Skip to content

Add structured log for unhandled promise rejections via window.onunhandledrejection #647

Description

@Chucks1093

Summary

Unhandled promise rejections (e.g. from fire-and-forget async calls outside React) are silently swallowed in production. A window.onunhandledrejection handler should capture these and emit a structured log before they disappear.

Scope

  • Register a window.onunhandledrejection handler on app initialisation alongside the existing window.onerror handler
  • Emit a debug-level structured log on each unhandled rejection with fields: reason, promise_origin, rejected_at
  • Handler should not suppress the default browser behaviour
  • Handler registered once on init, not on re-renders
  • Log not emitted in the test environment

Acceptance Criteria

  • Handler registered once on app init
  • Structured log emitted for each unhandled rejection with all three fields
  • Default browser behaviour preserved
  • Handler does not duplicate logs already caught by the React error boundary
  • Log not emitted in test environment

ETA: 12 hours


Coordinate on Telegram

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave program

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions