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异常。
ET exception, your new exception class should inherit from one of the.
et的异常,你的异常类应该从一个。
For example, to refer to PHP Exception class, you would use $error = new \Exception();.
例如,要想引用PHPException类,应该使用 $error =new \Exception();。
Select the GraphicException class as the exception to add. (See Figure 11 and Figure 12.)
选择graphicexception类作为要添加的异常(参见图11和图12。)
To do that, declare a a special exception class that indicates the result has been signalled already.
为此,需要声明一个专门的异常类,指出已经告知结果。
Adding a constructor or two for each exception class rarely takes more than a few minutes per exception.
对于一个异常,为每个异常类添加一个或两个构造器,所花费时间很少不超过几分钟。
To see how this works, begin by creating a custom exception class that extends Zend_Exception, as in Listing 13.
要了解它是如何工作的,我们要先通过扩展Zend_Exception创建一个自定义异常类,如清单13所示?
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接口。
Checked exceptions inherit from exception class and are used to handle recoverable errors such as business error scenarios.
已检查异常继承自exception类并用于处理可恢复性出错诸如业务出错场景。
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.
当用户看到错误消息时,该消息从引发的异常的描述字符串派生,而不是从异常类派生。
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的不变性。
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.
如果提供程序内发生的内部错误没有映射到其他已存在的异常类,则提供程序也使用此异常类来引发异常。
This exception is thrown during the verification stage of the linking phase of class loading.
这个异常是在类装入的链接阶段的校验过程中抛出。
In this class, you define what the client page does with the data (or the exception) when the server is done.
在这个类中,定义服务器操作完成时客户机页面如何处理数据(或异常)。
The handler attribute specifies the class which is asked to handle this exception when it occurs.
这个异常属性指明了当发生这个异常时被调用来处理这个异常的类。
Another way of handling this problem would be to throw an exception whenever a run-time instantiation of the generic class does not include a needed constructor.
处理该问题的另一种方法是:只要泛型类的运行时实例化没有包括所需构造函数,就抛出异常。
Throw an exception whenever a run-time instantiation of the generic class does not include a needed constructor.
只要泛型类的运行时实例化没有包括所需的构造函数,就抛出异常。
In class society everyone lives as a member of a particularclass, and every kind of thinking, without exception, is stamped with the brand of a class.
在阶级社会中,每一个人都在一定的阶级地位中生活,各种思想无不打上阶级的烙印。
Now, if you try to fetch the last element as a JButton, a class cast exception happens at run time
现在,如果您尝试将最后一个元素作为JButton 来提取,则在运行时会出现一个类转换异常
Typical join points in AspectJ include method calls, access to class members, and the execution of exception handler blocks.
AspectJ中典型的joinpoint包括方法调用、对类成员的访问以及异常处理程序块的执行。
To make the Mortgage Calculator user-friendly, I put an exception in the original MortgageCalculator class.
为了使抵押计算器具有友好的用户界面,我将在最初的MortgageCalculator类中加入异常(处理)。
The handler uses a support class LoggingWindow, which puts the exception up on the screen.
处理程序使用了一个支持类LoggingWindow ,该类将异常显示在屏幕上。
The handler uses a support class LoggingWindow, which puts the exception up on the screen.
处理程序使用了一个支持类LoggingWindow ,该类将异常显示在屏幕上。
应用推荐