Skip to content

Commit dd8683b

Browse files
test(e2e): Add the async error scenario for verifying #7138
1 parent 92629a3 commit dd8683b

2 files changed

Lines changed: 24 additions & 0 deletions

File tree

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Scenario for the #7138 verification: one captured async error whose stack has
2+
# Hermes InternalBytecode.js frames. "Capture Async Error" throws after an
3+
# `await` and captures the error, so the event carries the promise frames.
4+
appId: io.sentry.reactnative.sample
5+
---
6+
- runFlow: steps/launch.yml
7+
- runFlow:
8+
file: steps/open-errors-screen-button.yml
9+
env:
10+
BUTTON: 'Capture Async Error'
11+
- takeScreenshot: async-error-captured

‎samples/react-native/src/Screens/ErrorsScreen.tsx‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,19 @@ const ErrorsScreen = (_props: Props) => {
143143
Promise.reject('Unhandled Promise Rejection');
144144
}}
145145
/>
146+
<Button
147+
title="Capture Async Error"
148+
onPress={async () => {
149+
// Created after an `await`, so its stack has Hermes promise frames
150+
// (InternalBytecode.js). Used by the verify-pr run for #7138.
151+
try {
152+
await Promise.resolve();
153+
throw new Error('Async error after await');
154+
} catch (error) {
155+
Sentry.captureException(error);
156+
}
157+
}}
158+
/>
146159
<Button
147160
title="Native Crash"
148161
onPress={() => {

0 commit comments

Comments
 (0)