java - Java打印InternalError实际错误

标签 java error-handling

在代码中,我遇到了InternalError。我希望能够打印出实际错误。

但是,实际错误远远不在堆栈中。实际错误是
Caused by: java.io.IOException: Unable to tunnel through proxy. Proxy returns "HTTP/1.1 504 Gateway Timeout"

Exception in thread "Thread-13" java.lang.InternalError: Should not reach 
here
at java.net.HttpConnectSocketImpl.doTunneling(Unknown Source)
at java.net.HttpConnectSocketImpl.doTunnel(Unknown Source)
at java.net.HttpConnectSocketImpl.access$200(Unknown Source)
at java.net.HttpConnectSocketImpl$2.run(Unknown Source)
at java.net.HttpConnectSocketImpl$2.run(Unknown Source)

....

at checker.ui.panels.SystemCheckPanel.run(SystemCheckPanel.java:1058)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
... 15 more
Caused by: java.io.IOException: Unable to tunnel through proxy. Proxy returns "HTTP/1.1 504 Gateway Timeout"
at sun.net.www.protocol.http.HttpURLConnection.doTunneling(Unknown Source)
... 19 more'

我如何打印实际错误为504消息。

最佳答案

 try {
    blah...
 } catch (IOException e) {
     Throwable cause = e.getCause();
     System.out.println(cause.getMessage());
}

关于java - Java打印InternalError实际错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44034502/

相关文章:

node.js - 使用NodeJS和Express显示在哪里抛出错误500

node.js - AWS Lambda 错误 - "errorType": "string", "errorMessage": "handled"

symfony - 如何在服务中进行正确的错误处理

java - 在 JasperReports 中使用 ArrayList 作为主要数据源 - 仅打印第一个元素

java - Java TreeSet 和 HashSet 是否期望使用相同的数据给出不同的结果?

java - 如何处理我的 Recyclerview 的 onClick 项目

java - 如何参数化字符串并替换参数

bash 通过电子邮件发送错误

java - Java中的类型转换也会引起内存字节的转换吗?

c# - 将 WinForm 应用程序中的异常冒泡到 WPF 应用程序中。是否可以?