handler

Coverity Documentation

Version
latest

Represents exception handlers in try/catch blocks.

Properties

handler produces a record that contains the following properties:

Name Type Description
body blockStatement The body of the exception handler
variable localVariableSymbol The variable representing the exception caught

Example

The following CodeXM pattern matches handlers that declare a variable named Exception in catch statements; for example, catch ( Exception ex ):


CXM code follows
    let exceptionHandleWithVar = pattern {
        handler {
            .variable == NonNull
        }
    }
    in
    pattern tryCatchWithVar {
        tryStatement as t where
            exists r in t.catchBlockList where
                r matches exceptionHandleWithVar
    };

See also

tryStatement