处理错误代码

扫码查看
本文介绍了处理错误代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



在我的应用程序发生异常时,我需要根据我需要的错误代码将错误代码从业务层

传递到Presentation层显示数据库中可用的消息。

我想知道如何传递并获取表示层中的错误代码。

用于记录我正在使用的异常log4net和企业库4.0。



提前致谢

Hi,
In my application when exception occurs i need to pass the Error Code from the Business Layer
to the Presentation layer here based on the error code i need to show the message that is available in the DB.
I want to know how to pass and get the Error code in the Presentation Layer.
For logging Exceptions i am using log4net and Enterprise library 4.0.

Thanks in advance

推荐答案

try
{
    ...some code
}
catch (MyException mex)
{
    string msg = GetMessage(mex.ErrorCode);
    ...
}
catch (System.Exception ex)
{
    ...
}


这篇关于处理错误代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-22 17:44
查看更多