The Standardized Hooks System honors exceptions in hook action code or in check actions. The use of exceptions is commonplace for many developers.
- When hook action code, or the check action in a blocking event, raises an exception, the dispatch loop will halt iteration, log the exception to the
/usr/local/cpanel/logs/error_logfile, and proceed to iterate through any rollback actions.
- When a non-blocking event raises an exception, the dispatch loop will log the exception, but continue to iterate through any remaining hook actions.
Exceptions in Perl modules
In Perl code, you can use any Perl function that normally raises an exception (for example,
die()). The message body must contain the term
Exceptions in scripts
Different scripting languages have different implementations of exceptions. To raise an exception in a script, the script must print
STDOUT and exit.
The following sections illustrate how to raise an exception that will print
Could not connect to remote server in the error log.
The following example Perl code includes an exception:
The following example script includes an exception: