[Prev: case] [Home] [Next: continue]

catch

try {
    Statements;
}
catch( exception ) {
    ExceptionStatements;
}

This keyword is used in try statements. If an exception occurs, then the ExceptionStatements in a matching catch block are executed.

Catch blocks come in two varieties, unqualified and qualified. An unqualified catch block has the form:

    catch ( e ) {
        /* statements */
    }

and a qualified catch block has the form:

    catch ( e if e instanceOf RangeError ) {
        /* statements */
    }

The possible exception types are:

See try for an example.

[Prev: case] [Home] [Next: continue]