Skip to content

Potential unhandled promise rejections in visibility change handlers #58

Description

@coderabbitai

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P3Tasks of Lowest Importance and Impact

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions