Send useful errors through a custom exception class
通过自定义的异常类传递有用的错误
Listing 4 shows a JAX-RPC compliant exception class.
清单4展示了遵循JAX - RPC的异常类。
For example, Listing 3 shows an unsupported exception class.
举例来说,清单3展示了不支持的异常类。
This is a generic PHP exception class that is caught in PHP scripts.
这是在php脚本中捕获的通用php异常。
For instance, Axis 1.4 generates a custom exception class, but it is never thrown at runtime by the Web service.
例如,Axis 1.4生成了一个自定义异常类,但是Web服务在运行时决不会抛出该异常。
Spring's data access facilities automatically translate data-access exceptions into this exception class hierarchy.
Spring的数据访问功能自动将数据访问异常转换为此异常类层次结构。
The exception class that is thrown should be the most specific exception available that fits the error conditions.
引发的异常类应该是符合错误条件的最确切的可用异常。
All you need to do is have the custom exception class extend the exception class and implement the IsSerializable interface.
只需让定制的异常类扩展exception类并实现IsSerializable接口。
Spring defines a coherent data access exception class hierarchy (Figure 12) that you can use as a basis for your service- and DAO-layer exceptions.
Spring定义了一致的数据访问异常类层次结构(请参见图12),您可以将其用作服务和DAO 层异常的基础。
When the user sees an error message, it is derived from the description string of the exception that was thrown, rather than from the exception class.
当用户看到错误消息时,该消息从引发的异常的描述字符串派生,而不是从异常类派生。
This exception class is also used by providers to throw exceptions when internal errors occur within the provider that do not map to other pre-existing exception classes.
如果提供程序内发生的内部错误没有映射到其他已存在的异常类,则提供程序也使用此异常类来引发异常。
For example, to refer to PHP Exception class, you would use $error = new \Exception();.
例如,要想引用PHPException类,应该使用 $error =new \Exception();。
For example, they can help you test your custom Exception class, verify that your datatype's Equals & GetHashCode are consistent, and check IList invariants.
例如,它可以帮你测试自定义的异常类,验证自定义类型的Equals和GetHashCode方法是否一致,以及检查IList的不变性。
For example, they can help you test your custom Exception class, verify that your datatype's Equals & GetHashCode are consistent, and check IList invariants.
例如,它可以帮你测试自定义的异常类,验证自定义类型的Equals和GetHashCode方法是否一致,以及检查IList的不变性。
应用推荐