Skip to content

Commit

Permalink
Merge branch 'main' into expo
Browse files Browse the repository at this point in the history
  • Loading branch information
krystofwoldrich committed Jan 15, 2024
2 parents b51f045 + 9aa72e9 commit e0f5713
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## Unreleased

### Fixes

- Errors from InternalBytecode.js are no longer marked as in_app ([#3518](https://github.com/getsentry/sentry-react-native/pull/3518))

## 5.16.0-alpha.4

### Fixes
Expand Down
4 changes: 4 additions & 0 deletions src/js/integrations/rewriteframes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ export function createReactNativeRewriteFrames(): RewriteFrames {
}

const appPrefix = 'app://';
// https://github.com/getsentry/sentry-react-native/issues/3348
if (frame.filename === '/InternalBytecode.js') {
frame.in_app = false;
}
// We always want to have a triple slash
frame.filename =
frame.filename.indexOf('/') === 0 ? `${appPrefix}${frame.filename}` : `${appPrefix}/${frame.filename}`;
Expand Down
33 changes: 33 additions & 0 deletions test/integrations/rewriteframes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -859,4 +859,37 @@ describe('RewriteFrames', () => {
},
});
});

it('InternalBytecode should be flaged as not InApp', async () => {
mockFunction(isHermesEnabled).mockReturnValue(true);

const IOS_REACT_NATIVE_HERMES = {
message: 'Error: lets throw!',
name: 'Error',
stack:
'at anonymous (/Users/username/react-native/sdks/hermes/build_iphonesimulator/lib/InternalBytecode/InternalBytecode.js:139:27)',
};

const exception = await exceptionFromError(IOS_REACT_NATIVE_HERMES);

expect(exception).toEqual({
value: 'Error: lets throw!',
type: 'Error',
mechanism: {
handled: true,
type: 'generic',
},
stacktrace: {
frames: [
{
filename: 'app:///InternalBytecode.js',
function: 'anonymous',
lineno: 139,
colno: 27,
in_app: false,
},
],
},
});
});
});

0 comments on commit e0f5713

Please sign in to comment.