sentry-react-native icon indicating copy to clipboard operation
sentry-react-native copied to clipboard

Bug in @sentry/react-native Module with Error Handling Using String Cause

Open Kobby-Bawuah opened this issue 1 year ago • 0 comments

SDK version: (Assuming latest as not specified)

Are you using sentry.io or on-premise? [ x] sentry.io (SaaS)

If you are using sentry.io, please post a link to your issue so we can take a look:


I have the following issue:

With regard to the @sentry/react-native SDK, a user reported that particularly within js/integrations/nativelinkederrors.js, there's a bug related to handling errors with a string cause. When an error is thrown with a string cause like so throw new Error("Error with string cause", { cause: "string cause" }), the SDK fails with a runtime error "right operand of 'in' is not an object", which seems to occur because the linkedError (the cause) is a string and not an object.

Steps to reproduce: Step 1: Implement @sentry/react-native in a React Native project. Step 2: Throw an error using throw new Error("Error with string cause", { cause: "string cause" }).

Actual result:

The SDK generates a runtime error stating "right operand of 'in' is not an object", failing to handle the error as expected.

Expected result:

The SDK should gracefully handle errors thrown with a string cause, without generating runtime errors.

Kobby-Bawuah avatar Mar 08 '24 18:03 Kobby-Bawuah