in src/main/java/com/intellij/rt/debugger/agent/CaptureStorage.java [88:114]
public static void captureThrowable(final Throwable throwable) {
if (!ENABLED || THROWABLE_CAPTURE_DISABLED.get()) {
return;
}
withoutThrowableCapture(new Runnable() {
@Override
public void run() {
// TODO: support coroutine stack traces
try {
if (DEBUG) {
System.out.println("captureThrowable " + getCallerDescriptorForLogging() + " - " + getKeyText(throwable));
}
CapturedStack stack = getStacksForCurrentThread().peekLast();
if (stack != null) {
// Ensure that we don't leak throwable here, IDEA-360126
assert !(stack instanceof ExceptionCapturedStack) ||
((ExceptionCapturedStack) stack).myException != throwable;
STORAGE_THROWABLES.put(throwable, stack);
}
}
// TODO: check whether it's ok to use assertions, and if we should catch Throwable everywhere
catch (AssertionError | Exception e) {
handleException(e);
}
}
});
}