Preventing All Abnormal Terminations

ALGOL and NEWP programs can use the TRY statement to protect processes against abnormal terminations.

Before the implementation of the TRY statement, the best-known method of protection was the ON statement in ALGOL and NEWP. The ON statement is discussed under Protecting a Process from Faults later in this section. Compared to the ON statement, the TRY statement provides the following advantages:

  • Protection against a broader range of otherwise fatal conditions.

  • Alternate sets of error handling code to be executed if the error handling code itself incurs an error.

  • Faster execution.