NAME

Mojo::Exception - Exceptions With Context

SYNOPSIS

    use Mojo::Exception;
    my $e = Mojo::Exception->new;

DESCRIPTION

Mojo::Exception is a container for exceptions with context information.

ATTRIBUTES

Mojo::Exception implements the following attributes.

line

    my $line = $e->line;
    $e       = $e->line([3, 'foo']);

lines_after

    my $lines = $e->lines_after;
    $e        = $e->lines_after([[1, 'bar'], [2, 'baz']]);

lines_before

    my $lines = $e->lines_before;
    $e        = $e->lines_before([[4, 'bar'], [5, 'baz']]);

message

    my $message = $e->message;
    $e          = $e->message('Oops!');

verbose

    my $verbose = $e->verbose;
    $e          = $e->verbose(1);

METHODS

Mojo::Exception inherits all methods from Mojo::Base and implements the following new ones.

new

    my $e = Mojo::Exception->new('Oops!');
    my $e = Mojo::Exception->new('Oops!', $file);

to_string

    my $string = $e->to_string;
    my $string = "$e";

SEE ALSO

Mojolicious, Mojolicious::Book, http://mojolicious.org.