Skip to content

test: add unit tests for window.onerror handler not re-logging errors caught by React error boundary - #714

Merged
Chucks1093 merged 2 commits into
accesslayerorg:devfrom
samjay8:fix/issue-680
Jul 28, 2026
Merged

test: add unit tests for window.onerror handler not re-logging errors caught by React error boundary#714
Chucks1093 merged 2 commits into
accesslayerorg:devfrom
samjay8:fix/issue-680

Conversation

@samjay8

@samjay8 samjay8 commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Closes #680

Summary

  • Adds a global error handler utility that prevents window.onerror from re-logging errors already caught by React error boundaries
  • Modifies SectionErrorBoundary to mark caught errors so the global handler can skip them
  • Provides a structured logging format with full error metadata for genuine unhandled errors
  • Initializes the handler at app startup in main.tsx

Testing

  • Unit tests cover boundary-caught errors, unhandled errors, duplicate prevention, and coexistence of both handlers
  • All 14 new tests pass (src/utils/tests/globalErrorHandler.utils.test.ts)
  • All 4 existing SectionErrorBoundary tests continue to pass

@drips-wave

drips-wave Bot commented Jul 28, 2026

Copy link
Copy Markdown

@samjay8 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

@Chucks1093
Chucks1093 merged commit 0ccb419 into accesslayerorg:dev Jul 28, 2026
1 check passed
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.

Add unit tests for the window.onerror handler not re-logging errors already caught by the React error boundary

2 participants