Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[expression] Add try() function to provide a way to detect and handle
expressions which can intermittently fail.
- Loading branch information
Showing
3 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"name": "try", | ||
"type": "function", | ||
"description": "Tries an expression and returns its value if error-free. If the expression returns an error, an alternative value will be returned when provided otherwise the function will return null.", | ||
"arguments": [ | ||
{"arg":"expression","description":"the expression which should be run"}, | ||
{"arg":"alternative","optional":true,"description":"the result which will be returned if the expression returns an error."} | ||
], | ||
"examples": [ | ||
{ "expression":"try( to_int( '1' ), 0 )", "returns":"1"}, | ||
{ "expression":"try( to_int( 'a' ), 0 )", "returns":"0"}, | ||
{ "expression":"try( to_date( 'invalid_date' ) )", "returns":"NULL"} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters