Implement a global exception handling service that:
- Lets code throw global exceptions by type.
- Looks up handlers in a registry.
- Dispatches handlers in order (supports async) and isolates failures.
- Supports idempotent handlers (skip within a short window).
- Returns a DispatchResult for telemetry.
AuthError
,NetworkError
,FeatureFlagError
,UnknownError
.
logToSentry
,showToast
,navigateToLogin
,clearAuth
.
- Working implementation in
src/exceptionService.ts
andsrc/setupRegistry.ts
. - Tests in
__tests__/
must pass (you may add more).
- Per-type rate limiting (e.g., max once per 3s).
- Per-handler timeout/cancellation.
- React error boundary that funnels errors into the service.
npm i
npm test
npm run build