Skip to content

Commit

Permalink
temporary solution checking if frames exists before extracting the va…
Browse files Browse the repository at this point in the history
…lue (#743)

#742
  • Loading branch information
chgsilva authored and HazAT committed Jan 27, 2020
1 parent d1caf7c commit 2b9e9e1
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions android/src/main/java/io/sentry/RNSentryModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -317,13 +317,17 @@ public void sendEvent(ReadableMap event, Promise promise) {
ReadableNativeMap exception = exceptionValues.getMap(0);
if (exception.hasKey("stacktrace")) {
ReadableNativeMap stacktrace = exception.getMap("stacktrace");
ReadableNativeArray frames = (ReadableNativeArray)stacktrace.getArray("frames");
if (exception.hasKey("value")) {
addExceptionInterface(eventBuilder, exception.getString("type"), exception.getString("value"), frames);
} else {
// We use type/type here since this indicates an Unhandled Promise Rejection
// https://github.com/getsentry/react-native-sentry/issues/353
addExceptionInterface(eventBuilder, exception.getString("type"), exception.getString("type"), frames);
// temporary solution until final fix
// https://github.com/getsentry/sentry-react-native/issues/742
if (stacktrace.hasKey("frames")) {
ReadableNativeArray frames = (ReadableNativeArray)stacktrace.getArray("frames");
if (exception.hasKey("value")) {
addExceptionInterface(eventBuilder, exception.getString("type"), exception.getString("value"), frames);
} else {
// We use type/type here since this indicates an Unhandled Promise Rejection
// https://github.com/getsentry/react-native-sentry/issues/353
addExceptionInterface(eventBuilder, exception.getString("type"), exception.getString("type"), frames);
}
}
}
}
Expand Down

0 comments on commit 2b9e9e1

Please sign in to comment.