Eclipse 中的异常断点 - 如何检查异常对象? [英] Breakpoint at exception in Eclipse - how to examine Exception object?

查看:31
本文介绍了Eclipse 中的异常断点 - 如何检查异常对象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我觉得我在这里遗漏了一些非常简单的东西.我已将 Eclipse 设置为中断所有异常.因此,假设它在 AssertationFailedException 上中断.调试窗口将显示线程挂起并具有以下数据:

I feel like I'm missing something very simple here. I have Eclipse set up to break on all exceptions. So, let's say that it breaks on an AssertationFailedException. The Debug window will show that thread suspended and has the following data:

Thread [Thread-1] (Suspended (exception AssertionFailedException)) 
    ContactManager.addContact(String) line: 93  
    ContactManager$ContactDataCallback.dispatch(String, Element, ClientConnector) line: 118 
    PacketHandler.handle(FractusPacket) line: 173   
    ServerConnection.syncProcess(FractusMessage) line: 122  
    ServerConnection.run() line: 248    
    Thread.run() line: 636

但是,我正在寻找的文本,例如:Getter 被称为 observable org.eclipse.core.databinding.observable.set.WritableSet@4b7361e2 的外部领域",直到我单步执行异常(从而将其一直传播到堆栈)才可用异常、文本(这是我想要的部分)和堆栈跟踪.

However, the text that I'm looking for, such as: "Getter called outside realm of observable org.eclipse.core.databinding.observable.set.WritableSet@4b7361e2", is not available until I step through the exception (thus propagating it all the way up the stack) where it outputs the type of the exception, the text (which is the part that I want) and the stack trace.

如何检查AssertationFailedException"(或任何其他异常)以获取构造异常的消息?当然,我是在调试视角.

How can I examine the "AssertationFailedException" (or any other exception) in order to get the message with which the exception was constructed? Of course I'm in the Debug perspective.

推荐答案

Eclipse Preferences 中有一个选项可以检查抛出的异常:

There is an option in the Eclipse Preferences that allows inspecting of the thrown exception:

检查 Java ->调试 ->异常挂起时打开弹出窗口

使用此选项将有一个弹出窗口允许检查异常.

With this option there will be a popup allowing inspection of the exception.

奇怪的是这个选项默认没有被选中,因为它非常有用!

Strange that this option is not checked by default as it is very useful !

这篇关于Eclipse 中的异常断点 - 如何检查异常对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆