Java: what information in error stack trace do we typically not wish to show users?

前端 未结 7 1024
悲&欢浪女
悲&欢浪女 2020-12-11 02:47

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

7条回答
  •  自闭症患者
    2020-12-11 03:24

    You should not show any information to your end users that they cannot understand, which includes all of the stack trace in its entirety. The error you should show when you catch an exception like that should read something like this, in the language of your end-users:

    • Our program has experienced temporary difficulties. Please call technical support line for assistance.

    End users couldn't care less about your program's inner organization, databases, stacks, et cetera. All they know is that something that they thought should have work just failed, so they are looking for assistance.

    Stack traces are for error logs: you can save them for yourself, or e-mail them to technical support, but you do not want to show them to the end users.

提交回复
热议问题