Skip to content

Add structured log for client-side JavaScript errors via window.onerror handler #588

Description

@Chucks1093

Summary

Unhandled JavaScript errors that occur outside of React's render cycle (e.g. in event handlers, async callbacks, or third-party scripts) are never captured in structured logs. A window.onerror handler should capture these and emit a structured log before they disappear silently.

Scope

  • Register a window.onerror handler on app initialisation
  • Emit a debug-level structured log on each unhandled error with fields: message, source, line, col, error_type
  • Handler should not suppress the default browser error behaviour (return false)
  • Handler should be registered once and not re-registered on re-renders

Acceptance Criteria

  • Handler registered once on app init, not on re-render
  • Structured log emitted for each unhandled error with all five fields
  • Default browser error behaviour preserved
  • Handler does not catch errors already caught by the React error boundary

ETA: 12 hours


Coordinate on Telegram

Metadata

Metadata

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