You can add an exception to the method signature based on an existing RAISE EXCEPTION statement of the method implementation.
Example
Before Execution | After Execution |
---|---|
To copy the source code example, click here Code Example Before Execution |
|
In the implementation of the drive method, the check_fuel method that can raise an exception is called. In order to propagate the exception, you need to define it in the public section. | In the signature of the drive method, the cx_no_fuel exception class is added to the RAISING clause. |