管理异常消息的最佳实践

编程入门 行业动态 更新时间:2024-10-07 10:14:47
本文介绍了管理异常消息的最佳实践的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

你好, 自从我上次在这个网站上发布消息以来已经有一段时间了。通常我可以找到我正在寻找的东西,但今天不是。 我想要找到的是一种在.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"[^].

更多推荐

管理异常消息的最佳实践

本文发布于:2023-11-05 10:32:34,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1560594.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:异常   消息

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!