NAME

OpenGbg::Exception - Exception role

VERSION

Version 0.1302, released 2015-01-17.

SYNOPSIS

use Safe::Isa;
use Try::Tiny:
my $handler = OpenGbg->new(key => 'secret-api-key');

my $response;
try {
    $response = $handler->styr_och_stall->get_bike_stations;
}
catch {
    my $error = $_;
    if($error->$_does('OpenGbg::Exception')) {
        $error->out;
    }
    else {
        die $_;
    }
};

DESCRIPTION

OpenGbg::Exception is the role all exceptions do.

ATTRIBUTES

info

An error message containing all information the thrown exception has about the error.

METHODS

out

Prints info and a stack trace.

fatal

Dies.

catch {
    my $error = $_;
    if($error->$_does('OpenGbg::Exception')) {
        $error->out->fatal;
    }
    else {
        die $_;
    }
};

SOURCE

https://github.com/Csson/p5-OpenGbg

HOMEPAGE

https://metacpan.org/release/OpenGbg

AUTHOR

Erik Carlsson <info@code301.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2015 by Erik Carlsson.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.