Skip to content

traceo-sdk-browser. Bug in BrowserClient.handleOnUnhandledRejectionEvent #11

@AlexeyBarsuk

Description

@AlexeyBarsuk

The handleOnUnhandledRejectionEvent of BrowserClient contains the code below

const reason = data.event.reason;
....
let stack = "";
if ("stack" in reason) {
  stack = reason.stack;
} else {
  stack = reason.toString();
}

It is said in documentation that PromiseRejectionEvent property "reason" can be either Object or some other value. In case "reason" is not Object, the error is ocured.

Снимок экрана 2024-10-12 в 20 09 23

In order to quick fix this issue there is a way to change the condition

if ("stack" in reason)

to

if (typeof reason == "object" && "stack" in reason)

Sorry, have no ability to make PR :(

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions