I\'m new to java and I\'m not that familiar with the formatting rules used by an error stack trace when it is thrown and subsequently displayed to an end-user of my web appl
As others have said, you should not report the stack-trace to users. Several others have suggested you display the getMessage()
text. I recommend not doing that. As I've said before:
throw
part) from completion of handling and reporting (the catch
part). Using the message means the message must be good for reporting, which moves responsibility for reporting to the location that should be responsible for only detection and initiation. That is, I'd argue that the getMessage()
part of the design of Throwable
was a mistake.getLocalizedMessage()
is not much good because you might not know what locale you want to use until you catch
the exception (is the report to go to a system log read by your English system administrators, or is it to pop up in a window for the French user of the GUI?).