Next: Function Definition Expressions
Up: Language Syntax
Previous: Collection Expressions
Contents
Exception Expressions
Currently, EYEDB OQL does not provide full support for exception
management as there is no try/catch operator.
Nevertheless, the throw operator allows us to raise
an error message, for instance:
if (!check(p))
throw "variable p is not correct".
The throw operator stops the current thread of statements
and returns the error message at the uppest level. In the following
code:
a := 1;
throw "this is an error";
b := 2;
the variable a will be assigned to 1, but the
variable b will not be assigned to 2 as the
throw expression deroutes the normal thread of statements.
The throw operator is often used in the body of functions,
| General Information |
| Operator |
throw |
| Syntax |
throw expr |
| Type |
unary |
| Operand Type |
string |
| Result Type |
nil |
| Functions |
raises an error message |
| Expression Examples |
| throw "error message" |
nil |
| throw "error #1: " + msg |
nil |
Next: Function Definition Expressions
Up: Language Syntax
Previous: Collection Expressions
Contents
EyeDB manual