The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Erlang::Parser::Node::Try - a try/catch clause

DESCRIPTION

A clause to catch exceptions. A block of expressions is evaluated; the last expression's value is optionally then matched against patterns and guards, and then a further block of statements executed. Exceptions raised therein can be caught in the catch clause. Finally, cleanup statements can be invoked.

Accessors

exprs

A list of Erlang::Parser::Nodes; the last expression's value is that used in the of clause.

of

An optional list of Erlang::Parser::Node::Alts against which the last expression in exprs is matched.

catch

An optional list of Erlang::Parser::Node::Alts for exceptions raised during evaluation in exprs and of.

aft

An optional list of Erlang::Parser::Nodes, executed after all previous statements.

Methods

print

Pretty-prints the node to its filehandle argument.

EXAMPLE

    try
        {ok, X} = my_fun(),
        binary_to_term(X)
    catch
        throw:Term -> Term
    after
        file:close(F)
    end