Before PowerBuilder 8, when a runtime or system error occurred in a PowerBuilder application, a single application event was fired to handle the error no matter where in the application the error happened.
Exception-handling classes and syntax are now available for context-sensitive error handling in PowerBuilder applications. This means that you can deal with errors closer to their source by embedding error-handling code anywhere in your application instead of in a single global error event. Well-designed exception-handling code can give application users a better chance to recover from error conditions and run the application without interruption.
With the addition of exception handling, PowerBuilder clients are able to catch exceptions thrown from EAServer components and recover from them. Components developed with PowerBuilder can also define and throw their own exception types, making them more consistent with other EAServer component types like Java.
Exception handling can be found in such object-oriented languages as Java and C++. The implementation for PowerBuilder is similar to the implementation of exception handling in Java.
Backward compatibility The Error event and the ExternalException event are maintained for backward compatibility. However, if you script these events, you will not be able to take advantage of the new exception handling features of PowerBuilder.
The behavior after the SystemError event has been triggered has also changed. In previous releases, if you coded the SystemError event to enable the application to continue, control returned to the script in which the runtime error was triggered. In this release, the event that triggered the runtime error is terminated and the call stack is unwound.