Skip to content

Commit deae97d

Browse files
committed
Catch invocation target exception
1 parent c543c63 commit deae97d

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

src/io/flutter/run/FlutterDebugSessionUtils.java

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import com.intellij.xdebugger.XDebuggerManager;
99
import org.jetbrains.annotations.NotNull;
1010

11+
import java.lang.reflect.InvocationTargetException;
1112
import java.lang.reflect.Method;
1213

1314
public class FlutterDebugSessionUtils {
@@ -57,8 +58,14 @@ public static RunContentDescriptor startSessionAndGetDescriptor(
5758
session.setBreakpointMuted(true);
5859
}
5960
return session.getRunContentDescriptor();
61+
} catch (InvocationTargetException e) {
62+
Throwable cause = e.getCause();
63+
if (cause instanceof ExecutionException) {
64+
throw (ExecutionException) cause;
65+
}
66+
throw new ExecutionException("Failed to start debug session via reflection", cause != null ? cause : e);
6067
} catch (Exception e) {
61-
throw new ExecutionException("Failed to start debug session via reflection", e);
68+
throw new ExecutionException("Failed with unexpected reflection error", e);
6269
}
6370
}
6471

@@ -75,8 +82,14 @@ public static XDebugSession startSession(
7582
} catch (NoSuchMethodException e) {
7683
// Fallback to old API
7784
return manager.startSession(env, starter);
85+
} catch (InvocationTargetException e) {
86+
Throwable cause = e.getCause();
87+
if (cause instanceof ExecutionException) {
88+
throw (ExecutionException) cause;
89+
}
90+
throw new ExecutionException("Failed to start debug session via reflection", cause != null ? cause : e);
7891
} catch (Exception e) {
79-
throw new ExecutionException("Failed to start debug session via reflection", e);
92+
throw new ExecutionException("Failed with unexpected reflection error", e);
8093
}
8194
}
8295
@NotNull

0 commit comments

Comments
 (0)