Exceptions


try ... catch ... finally
Syntax
try {
    statements;
} catch (e[:errorType]) {
    statements;
} finally {
    statements;
}
Usage
  • A try block must be followed by one or more catch blocks and/or by a single finally block.
  • The finally block always executes, whether or not an exception was thrown, even if the try block exits using a return statement.
throw
Syntax
  • throw expr;
  • throw new Error("...");