improve error handling and display
Status: Beta
Brought to you by:
philipp_t
Refactor the error handling and exception display - it would be great if there would be an option controlling how error messages are displayed. maybe one style for machine-readable error descriptions and one for bipedal carbon-based life forms. maybe another option for the verbosity of it - full exception with stacktrace vs. short error description.
example using the http bridge:
./get_mbean_proxy -H bobweb15 -p 4711 -m java.lang:type=Runtime/Uptime -o NAGIOS -v
get_mbean_proxy CRITICAL - 500 Internal Server Error
Verbose output
Prog. Name : get_mbean_proxy
Version : 0.2
Bridge : bermon01:8080 V0.1.3a
Host : bobweb15
Port : 4711
Timeout : 20s
Warning :
Critical :
Mbean : java.lang:type=Runtime/Uptime
Ausg. Typ : NAGIOS
String Typ : ERROR
Ergebnis : get_mbean_proxy CRITICAL - 500 Internal Server Error
Original : <html><head><title>Apache Tomcat/6.0.10 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 500 - </h1><HR size="1" noshade="noshade"><p><b>type</b> Exception report</p><p><b>message</b> <u></u></p><p><b>description</b> <u>The server encountered an internal error () that prevented it from fulfilling this request.</u></p><p><b>exception</b> <pre>javax.servlet.ServletException: Servlet execution threw an exception
</pre></p><p><b>root cause</b> <pre>java.lang.NoSuchMethodError: java.io.IOException: method <init>(Ljava/lang/Throwable;)V not found
org.hitchhackers.tools.jmx.connection.pool.PoolingConnectionFactory.getConnection(PoolingConnectionFactory.java:36)
org.hitchhackers.tools.jmx.commands.CommandBase.init(CommandBase.java:76)
org.hitchhackers.tools.jmx.CommandProcessor.init(CommandProcessor.java:66)
org.hitchhackers.tools.jmx.web.JMXConsoleServlet.doGet(JMXConsoleServlet.java:75)
javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
</pre></p><p><b>note</b> <u>The full stack trace of the root cause is available in the Apache Tomcat/6.0.10 logs.</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/6.0.10</h3></body></html>