Tim*_*lis 2 java eclipse debugging exception
有没有办法找出try块中哪一行抛出异常?
我正在研究Eclipse中的Java,看起来像
try {
//Lots of code. Seriously. Lots.
} catch (Exception e){
throw new OtherException();
}
Run Code Online (Sandbox Code Playgroud)
我在try块中遇到异常(然后被捕获).我如何弄清楚它被扔出去的地方?
问题
感觉应该有一种直截了当的方式来做到这一点.
注意:我没有写这段代码;-)
rle*_*ndi 13
使用cause
参数Exceptions
(见这里):
try {
//Lots of code. Seriously. Lots.
} catch (Exception e){
throw new OtherException(e); // Trick is here
}
Run Code Online (Sandbox Code Playgroud)
这样你cause
也可以在stacktrace中获得异常.
归档时间: |
|
查看次数: |
1713 次 |
最近记录: |