[React Native] Stack Trace does not include any application frames

Here is our actual React Native source code which throws the exception:

const throwException = () => {
  throw 'You clicked a button to intentionally throw an exception!'

const onException = () => {

export const ArtistProfile = () => (
    <Button title={I18n.t('ArtistProfile.exception')} style={styles.button} onPress={onException} />

This is what we see in sentry dashboard:

at captureMessage(/Users/mark/code/mobile/node_modules/raven-js/src/raven.js:376:0)
at captureException(/Users/mark/code/mobile/node_modules/raven-js/src/raven.js:325:0)
at ? (/Users/mark/code/mobile/node_modules/raven-js/plugins/react-native.js:124:0)
at reportFatalError(/Users/mark/code/mobile/node_modules/react-native/packager/react-packager/src/Resolver/polyfills/error-guard.js:40:0)
at guard(/Users/mark/code/mobile/node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:48:0)
at callFunctionReturnFlushedQueue(/Users/mark/code/mobile/node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:107:0)
at callFunctionReturnFlushedQueue([native code])

Obviously, that is not useful to us in the slightest.

Is our configuration wrong? How can we set up to see something useful in sentry dashboard?


I think I have solved the issue, at least for now. When I say throw 'Something', I experience the issue described in the initial post. However, if I trigger a runtime exception, e.g. myFunctionThatDoesNotExist(), I DO get to see the application code in sentry dashboard.

Strange. Why?

Can you try by throwing a real error? As in:

throw new Error('You clicked a button to intentionally throw an exception!');

instead. Without this being an actual error, we’re not really able to get a good stacktrace.

Works like a charm. I learned something about JS today. I didn’t realize you could throw things other than errors. I figured throw 'something' constructed an error object under the hood. Good to know. Thanks!

1 Like