[debugger] Do not throw ObjectCollectedException while extracting an exception message

GitOrigin-RevId: a6a9ac5d2bcf13973f4184c0ede3cb15bc407ce2
This commit is contained in:
Maksim Zuev
2025-06-12 16:13:55 +00:00
committed by intellij-monorepo-bot
parent 9aa5ca8ec0
commit 2b52a1ade3
2 changed files with 7 additions and 1 deletions
@@ -13,6 +13,7 @@ evaluation.error.sources.out.of.sync=Sources do not correspond to code being exe
evaluation.error.cannot.find.stackframe.source=Cannot find source class for current stack frame
evaluation.error.cannot.find.source=Cannot find source class for {0}
evaluation.error.object.collected=Object has been collected
evaluation.error.exception.collected=<Cause unknown as the exception has been collected>
evaluation.error.thread.collected=Thread has been collected
evaluation.error.array.collected=Array has been collected
evaluation.error.thread.resumed=Thread has been resumed
@@ -75,7 +75,12 @@ public final class EvaluateExceptionUtil {
return JavaDebuggerBundle.message("evaluation.error.object.collected");
}
else if (th instanceof InvocationException invocationException) {
return JavaDebuggerBundle.message("evaluation.error.method.exception", invocationException.exception().referenceType().name());
try {
return JavaDebuggerBundle.message("evaluation.error.method.exception", invocationException.exception().referenceType().name());
}
catch (ObjectCollectedException e) {
return JavaDebuggerBundle.message("evaluation.error.exception.collected");
}
}
else if (th instanceof EvaluateException) {
return th.getMessage();