Description
The onVisibilityChange handler in HTML5Adapter calls async methods (onMoveAway() and onMoveback()) without handling their returned Promises. While this is intentional for the fire-and-forget beacon pattern, if createEvent throws before addBeaconEventAndSend, the error will result in an unhandled promise rejection.
Location
- File:
sdk/src/adapters/HTML5Adapter.ts
- Lines: 95-101 (onVisibilityChange handler)
- Also applies to: Lines 424-434 (onMoveAway/onMoveback implementations)
Risk
Unhandled promise rejections may surface to the console if the async event creation/sending logic throws an error.
Context
This issue was identified during review of PR #50. While the scenario is considered less probable, it warrants further investigation and potential hardening of error handling in async visibility handlers.
Related
Description
The
onVisibilityChangehandler in HTML5Adapter calls async methods (onMoveAway()andonMoveback()) without handling their returned Promises. While this is intentional for the fire-and-forget beacon pattern, ifcreateEventthrows beforeaddBeaconEventAndSend, the error will result in an unhandled promise rejection.Location
sdk/src/adapters/HTML5Adapter.tsRisk
Unhandled promise rejections may surface to the console if the async event creation/sending logic throws an error.
Context
This issue was identified during review of PR #50. While the scenario is considered less probable, it warrants further investigation and potential hardening of error handling in async visibility handlers.
Related