Skip to content

Commit

Permalink
Remove checking throwable type
Browse files Browse the repository at this point in the history
  • Loading branch information
Bartosz Litwiniuk committed Nov 16, 2023
1 parent 6bc480d commit 80859ed
Showing 1 changed file with 7 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,23 +53,18 @@ public static void enable(BacktraceClient client) {
public void uncaughtException(final Thread thread, final Throwable throwable) {
OnServerResponseEventListener callback = getCallbackToDefaultHandler(thread, throwable);

if (throwable instanceof Exception) {
BacktraceLogger.e(LOG_TAG, "Sending uncaught exception to Backtrace API", throwable);
BacktraceReport report = new BacktraceReport((Exception) throwable, BacktraceExceptionHandler.customAttributes);
report.attributes.put(BacktraceAttributeConsts.ErrorType, BacktraceAttributeConsts.UnhandledExceptionAttributeType);
this.client.send(report, callback);
BacktraceLogger.d(LOG_TAG, "Uncaught exception sent to Backtrace API");
}
BacktraceLogger.d(LOG_TAG, "Default uncaught exception handler");
BacktraceLogger.e(LOG_TAG, "Sending uncaught exception to Backtrace API", throwable);
BacktraceReport report = new BacktraceReport((Exception) throwable, BacktraceExceptionHandler.customAttributes);
report.attributes.put(BacktraceAttributeConsts.ErrorType, BacktraceAttributeConsts.UnhandledExceptionAttributeType);
this.client.send(report, callback);
BacktraceLogger.d(LOG_TAG, "Uncaught exception sent to Backtrace API");

try {
signal.await();
} catch (Exception ex) {
BacktraceLogger.e(LOG_TAG, "Exception during waiting for response", ex);
}
}

private boolean isMainThread() {
return Looper.myLooper() == Looper.getMainLooper();
BacktraceLogger.d(LOG_TAG, "Default uncaught exception handler");
}

private OnServerResponseEventListener getCallbackToDefaultHandler(final Thread thread, final Throwable throwable) {
Expand Down

0 comments on commit 80859ed

Please sign in to comment.