Skip to content

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

Closed

Description

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.

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

Metadata

Assignees

Type

No type

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions