【发布时间】:2010-09-20 13:37:12
【问题描述】:
在编写引发我询问here 的异常的代码时,我来到了消息的结尾,并在标点符号处停了下来。我意识到我抛出的几乎每条异常消息都可能有一个!某处。
throw new InvalidOperationException("I'm not configured correctly!");
throw new ArgumentNullException("You passed a null!");
throw new StupidUserException("You can't divide by 0! What the hell were you THINKING??? DUMMY!!!!!");
您在编写异常消息时采用什么语气?浏览日志时,您是否发现某种特定风格的消息实际上比另一种更有帮助?
【问题讨论】:
标签: c# .net exception logging throw