The try Statement
Syntax
try {
[ statements ]
}
catch {
...
}
The try
statement runs a series of substatements in a block. If the
block returns an error such as fail
, reject
, invalid
, or
disallow
, a subsequent catch block is
executed.
- [ statements ]
-
The
unlang
commands which will be executed. Atry
block cannot be empty.
Every try
block must be followed by a catch
block.
Example
try {
sql
}
catch {
# ... run only if sql failed
ok # over-ride the "fail" code
}