Skip to content

Commit

Permalink
fix: Capture unhandled promise rejection on android
Browse files Browse the repository at this point in the history
Fixes #353
  • Loading branch information
HazAT committed Feb 16, 2018
1 parent df69335 commit da090f4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion android/src/main/java/io/sentry/RNSentryModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,13 @@ public void captureEvent(ReadableMap event) {
ReadableNativeArray exceptionValues = (ReadableNativeArray)event.getMap("exception").getArray("values");
ReadableNativeMap exception = exceptionValues.getMap(0);
ReadableNativeMap stacktrace = exception.getMap("stacktrace");
addExceptionInterface(eventBuilder, exception.getString("type"), exception.getString("value"), stacktrace.getArray("frames"));
if (exception.hasKey("value")) {
addExceptionInterface(eventBuilder, exception.getString("type"), exception.getString("value"), stacktrace.getArray("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"), stacktrace.getArray("frames"));
}
}

Sentry.capture(buildEvent(eventBuilder));
Expand Down

0 comments on commit da090f4

Please sign in to comment.