你好, 自从我上次在这个网站上发布消息以来已经有一段时间了。通常我可以找到我正在寻找的东西,但今天不是。 我想要找到的是一种在.Net中集中异常消息的简单方法应用。因此整个异常处理都得到了解决,但是目前程序员正在编写异常抛出的消息。我在用户友好的消息和正在记录的实际异常之间进行了分离,但即便如此,您也可以针对同一类问题获得许多不同的消息。 我正在考虑的是使用枚举,在我们的自定义异常中转换成一条消息,但是考虑到这一点,我担心随着它的成长和发展它将会变得难以管理。 有没有人对此有任何想法?指向我一篇好文章也将非常感激。 问候, Franz
Hello, it's been a while since i last posted a message on this site. Usually i can find what i'm looking for, but not today. What i'm trying to find is an easy way to centralize exception messages in a .Net application. So the whole exception handling is taken care of, but currently the programmers are making up the messages that the exception throws. I made a separation between user-friendly messages and the actual exception that is being logged, but even then you can get many different messages for the same kind of problem. What i was thinking about was work with enums that translate into a message in our custom exception, but thinking this over i fear its going be hell to manage as it grows and grows. Does anyone have any thoughts on this? Pointing me to a good article would be very much appreciated as well. Regards, Franz
推荐答案可能这个代码项目文章符合您的需求:.NET中的异常处理最佳实践 [ ^ ]。 Possibly this Code Project article fits your needs: "Exception Handling Best Practices in .NET"[^].
更多推荐
管理异常消息的最佳实践
发布评论