Skip to content

Commit 11240d8

Browse files
committed
Print unhandled exceptions to stderr by default (like ThreadGroup does).
1 parent ca68cb9 commit 11240d8

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

CHANGES

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ Version 1.6.7
22
-------------
33

44
- Add Automatic-Module-Name to manifest so we have basic Java 9 support.
5+
- Print unhandled exceptions to stderr by default (like ThreadGroup does).
56

67
Version 1.6.6
78
-------------

sentry/src/main/java/io/sentry/SentryUncaughtExceptionHandler.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,15 @@ public void uncaughtException(Thread thread, Throwable thrown) {
5858
}
5959
}
6060

61+
// taken from ThreadGroup#uncaughtException
6162
if (defaultExceptionHandler != null) {
6263
// call the original handler
6364
defaultExceptionHandler.uncaughtException(thread, thrown);
65+
} else if (!(thrown instanceof ThreadDeath)) {
66+
// CHECKSTYLE.OFF: RegexpSinglelineJava
67+
System.err.print("Exception in thread \"" + thread.getName() + "\" ");
68+
thrown.printStackTrace(System.err);
69+
// CHECKSTYLE.ON: RegexpSinglelineJava
6470
}
6571
}
6672

0 commit comments

Comments
 (0)