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

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

问题描述

我觉得我在这里很简单。我已经将Eclipse设置为打破所有异常。所以我们假设它在一个AssertationFailedException中断。调试窗口将显示该线程已暂停并具有以下数据:

线程[Thread-1](已挂起(异常AssertionFailedException))
ContactManager .addContact(String)行:93
ContactManager $ ContactDataCallback.dispatch(String,Element,ClientConnector)行:118
PacketHandler.handle(FractusPacket)行:173
ServerConnection.syncProcess(FractusMessage)行:122
ServerConnection.run()行:248
Thread.run()行:636

但是,我正在寻找,如:
Getter被称为外观的可观察的org.eclipse.core.databinding.observable.set.WritableSet@4b7361e2,直到我通过异常(从而传播它一直到堆栈),它输出异常的类型,文本(这是我想要的部分)和堆栈跟踪。



我如何检查AssertationFailedException(或任何其他excel )以获取构造异常的消息?当然,我在Debug的视角。

解决方案

在Eclipse首选项中有一个允许检查抛出的异常的选项:



检查 Java - >调试 - >在例外情况下暂停弹出窗口



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



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


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

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.

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.

解决方案

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

Check Java -> Debug -> Open popup when suspended on exception

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天全站免登陆