6

在什么特定情况下可以(甚至推荐)在生产系统上向最终用户展示他们的 UI 的 StackTrace

有大量的网站和 SO 文章,人们询问是否应该向最终用户显示 StackTraces。毫不奇怪,答案是响亮的“不!” .

例如:

然而,我最近与另一位开发人员进行了一次对话,在那里我花了很多时间来解释为什么不应该通过 UI 将堆栈跟踪传递给用户。那次讨论让我回过头来重新审视我的一个基本(绝对)租户——用户永远不会在生产中看到原始的 StackTrace

我找不到一个令人信服的理由。但是,我确信有有效的用例,我想要么理解它,要么愿意继续坚持我的绝对租户。

4

4 回答 4

10

你没有——它们对用户没有帮助。

用户收到消息。开发人员可以在日志、电子邮件、队列中获得堆栈跟踪,也可能是在本地/内部运行时呈现的 HTML 等。

于 2012-06-19T18:35:39.843 回答
2

在这里,在我的办公室有许多不同的内部项目,我受益于看到其他部门的同事在我的程序崩溃时看到的堆栈跟踪。他们只是没有恶意或知识渊博,无法知道发生了什么,否则他们会和我一起工作。它还给了我一个窗口期来询问用户可能确定他们在做什么(虽然它仍然在他们的脑海中是新鲜的)。如果堆栈跟踪已被抑制或其他一些漂亮(但隐藏)的错误处理已经到位,那么除了通过堆栈跟踪之外,我可能不知道错误是如何发生的。

于 2012-06-19T18:21:57.297 回答
2

The stack trace should be available to the user when the application crashes, because a stack trace usually identifies the bug that causes the crash, and there might be a work around available. The work-around obviously works only if the crash is caused by the bug the work-around is for - otherwise attempting the work-around is just wasted time.

A crash might also be caused by a bug in something that the user needs to update, e.g. graphics driver. In this case, the stack trace usually contains the name of the graphics driver, such as atiumdag.dll.

Let's imagine:

No stack trace:

Customer: I get a message box saying "the program stopped working".

Support: Try this.

Customer: Nope, doesn't help.

Support: Try this.

Customer: Nope, doesn't help.

Support: Try this.

Customer: Nope, doesn't help.

Support: Try this.

Customer: Nope, doesn't help.

With stack trace:

Customer: I get a message box saying "the program stopped working".

Support: Click on the "details" button and send me the stack trace.

Customer: (sends the stack trace)

Support: This is caused by a known bug in the application, which is triggered by feature X when the application is installed in a non-default path. It will be fixed in the next version, which is released next year. However, you can work around it by either disabling feature X or re-installing the application in the default installation path.

于 2013-03-16T09:56:46.467 回答
1

in open source projects or where you have debug mode turned on. Maybe the user is using the application to learn how the technology works to make a similar app, or maybe they plan on contributing to it themselves.

There are many different types of users. I think allowing them to turn this option on is neat but it shouldn't be so easy where your average joe might turn on stacktraces by accident.

于 2012-06-21T15:52:36.797 回答