Route all fatal errors through a single shutdown handler#46
Route all fatal errors through a single shutdown handler#46maximmaxim345 merged 4 commits intomainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR consolidates all fatal error paths in the Cast receiver into a single handleFatalError function, eliminating ad-hoc handling across multiple code paths. It also adds ensureAudioContextSupported() and wraps SendspinPlayer construction in a try/catch to catch setup failures on unsupported devices.
Changes:
- Adds
handleFatalError(context, error, summary)as a single unified shutdown handler with idempotency guard, and refactors all fatal error paths (reconnect exhaustion, Cast framework errors, global JS errors, unhandled rejections) to route through it - Adds
ensureAudioContextSupported()and a try/catch aroundSendspinPlayerconstruction inconnectToServerto properly handle device capability failures - Updates README.md with a new "Error Handling" section documenting the fatal vs. non-fatal error distinction
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/js/main.ts |
Core refactor: adds handleFatalError, toErrorMessage, ensureAudioContextSupported; moves and routes all fatal error handlers through the new unified path |
README.md |
Adds "Error Handling" documentation section describing the fatal/non-fatal behavior |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Squash merge of fix/error-message
Return false from window.onerror to preserve browser default error reporting, and fix log prefix to match "Sendspin: ..." convention.
9464d7c to
629bc5f
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Non-Error values like Cast framework events rendered as [object Object] on screen.
Previously, several fatal failure paths (reconnect exhaustion, Cast framework errors, global JS errors, unhandled rejections) each had their own ad-hoc handling. They are now routed through a single
handleFatalErrorfunction that reports the error state to the sender, shows it on screen, and shuts down the app.Also adds
ensureAudioContextSupportedand wrapsSendspinPlayerconstruction in a try/catch so setup failures on unsupported devices are caught and reported the same way.