The WHEN ERROR statement marks the beginning of a WHEN ERROR construct. The WHEN ERROR construct contains a protected region and can include an attached or detached handler. Examples WHEN ERROR IN INPUT "Enter your hourly rate";hourly_rate% . . . USE SELECT ERR . . . END SELECT END WHEN WHEN ERROR USE error_trapper INPUT "Enter your hourly rate";hourly_rate% . . . END WHEN HANDLER error_trapper . . . END HANDLER
1 – Syntax
With an Attached handler: WHEN ERROR IN protected-statement [protected-statement,...] . . . USE handler-statement [handler-statement,...] . . . END WHEN With a Detached Handler: WHEN ERROR USE handler-name protected-statement [protected-statement,...] . . . END WHEN HANDLER handler-name handler-statement [handler-statement,...] . . . END HANDLER