Skip to content

Commit bb142e1

Browse files
authored
Fix general exception for native methods. (microsoft#148)
1 parent 7e082b5 commit bb142e1

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

com.microsoft.java.debug.core/src/main/java/com/microsoft/java/debug/core/StackFrameUtility.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import com.sun.jdi.AbsentInformationException;
1515
import com.sun.jdi.IncompatibleThreadStateException;
1616
import com.sun.jdi.InvalidStackFrameException;
17+
import com.sun.jdi.NativeMethodException;
1718
import com.sun.jdi.ReferenceType;
1819
import com.sun.jdi.StackFrame;
1920

@@ -32,8 +33,14 @@ public static boolean isNative(StackFrame frame) {
3233
public static void pop(StackFrame frame) throws DebugException {
3334
try {
3435
frame.thread().popFrames(frame);
35-
} catch (IncompatibleThreadStateException | InvalidStackFrameException e) {
36-
throw new DebugException(e.getMessage(), e);
36+
} catch (IncompatibleThreadStateException e) {
37+
throw new DebugException(String.format("%s occurred popping stack frame.", e.getMessage()), e);
38+
} catch (InvalidStackFrameException e) {
39+
throw new DebugException("Cannot pop up the top stack farme.", e);
40+
} catch (NativeMethodException e) {
41+
throw new DebugException("Cannot pop up the stack frame because it is not valid for a native method.", e);
42+
} catch (RuntimeException e) {
43+
throw new DebugException(String.format("Runtime exception happened: %s", e.getMessage()), e);
3744
}
3845
}
3946

0 commit comments

Comments
 (0)