Try a statement and if the statement fails with an error, then the error is returned. It is also possible to catch only specific errors.
It is possible to catch all errors with the exception of internal errors. Such errors should never happen, unless something is really wrong with at least one node.
This function does not generate an event.
try(statement, [e0, e1, ..., eX])
|statement||any (required)||The statement to try.|
|e0, e1, …, eX||int/raw (optional)||Only catch specific errors, if omitted, catch all errors. Error codes and names are accepted.|
The value for the specified statement or an error if the statement has failed.
This code shows some return values for try():
[ iserr( try( x = (1/0) )), iserr( try( (1/0), zero_div_err() )), ];
Return value in JSON format
[ true, true ]