catch
catch(primary
,iferror
)
The CATCH function has the following arguments:
primary
The primary expression to be evaluated.
iferror
The expression to be evaluated and returned if an error is detected while evaluating the primary expression.
This function will attempt to evalutate the first argument. If an error occurs during this evaluation (e.g. divide by zero exception) then the function will discard the results, and will instead return the value of the second argument.
Any data types may be returned by the primary expression, but note that the data types of the primary and iferror arguments must be identical.
Note that this function will catch run-time errors. Syntax and other compile-time issues will still result in a compile time failure.
Formula |
Description |
Result |
---|---|---|
catch(attribute('%f.Yield.%m.total'), curve(0,0)) | Try to lookup an attribute named '%f.Yield.%m.total'. Return the function if it exists. Otherwise, return a curve that has a value of 0. |