Method catch()
- Method
catch
mixedcatch(mixedexpression)- Description
Catch run time errors or other thrown values triggered by the evaluation of the expression.
- Parameter
expression Expression to evaluate.
Analogous to gauge(), there are two syntaxes:
mixed err = catch(expression);and
mixed err = catch { // Code block };Where the latter is more versatile and more common.
- Returns
Returns the value that was caught. If no value was caught
0is returned.- Note
catch is not a function, but a special form. It is thus not valid to pass as a function.
Note also that catch does not perform any filtering of the caught values. If a caught value is not of interrest it is up to user code to re-throw the value.
- See also