...异常处理机制 可以自定义异常处理策略,使得截获一个异常的同时引发另一个操作 • 应用程序自定义的异常(ApplicationException)应当写日志 • 数据库异常(SqlClientException)被截获后,被包装成另一个异常 (DataLayerException) 并重新抛出 • 安全异常(Secu...
基于12个网页-相关网页
Your exception hierarchy should begin with something fairly robust and generic, like ApplicationException.
异常层次结构应该从一些十分健壮而又通用的异常入手,如ApplicationException。
The answer is to provide a more useful type of exception that also contains a lower-level exception. Listing 1 shows a simple ApplicationException that does just this
答案是提供一类更有用的异常,它还包含低级异常。
First, the program did not hit the catch clause for an exception of type ApplicationException, even though that's the type of exception thrown from the static constructor.
第一,该程序不会为类型是ApplicationException的异常寻找catch子句,即使这种类型的异常是从静态构造函数引发的也如此。
应用推荐