Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sentry syntheticException should not capture it's own stack trace #11812

Open
krystofwoldrich opened this issue Apr 26, 2024 · 1 comment
Open

Comments

@krystofwoldrich
Copy link
Member

krystofwoldrich commented Apr 26, 2024

When object without stack trace is captured by captureException, syntheticException is created to capture where was the captureException called.

Currently the top of the stack trace is the syntheticException line and not the captureException call site.

Actual:
In ErrorsScreen.tsx called captureException('string')

npm:@sentry/core/cjs/hub.js in Hub#captureException at line 272:40
npm:@sentry/core/cjs/exports.js in captureException at line 23:45
/samples/react-native/src/Screens/ErrorsScreen.tsx in Button.props.onPress at line 78:35
npm:react-native/Libraries/Pressability/Pressability.js in _performTransitionSideEffects at line 789:17
npm:react-native/Libraries/Pressability/Pressability.js in _receiveSignal at line 726:40
npm:react-native/Libraries/Pressability/Pressability.js in responderEventHandlers.onResponderRelease at line 543:27

Expected:
In ErrorsScreen.tsx called captureException('string')

/samples/react-native/src/Screens/ErrorsScreen.tsx in Button.props.onPress at line 78:35
npm:react-native/Libraries/Pressability/Pressability.js in _performTransitionSideEffects at line 789:17
npm:react-native/Libraries/Pressability/Pressability.js in _receiveSignal at line 726:40
npm:react-native/Libraries/Pressability/Pressability.js in responderEventHandlers.onResponderRelease at line 543:27

Solution: port https://github.com/getsentry/sentry-react-native/blob/6227788926d3c82f6a1a50e410f63038cbd644d7/src/js/utils/error.ts#L11-L18 to JS Core

@AbhiPrasad
Copy link
Member

@krystofwoldrich would you like to open up a PR? 😄

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

No branches or pull requests

2 participants