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

OpenGbg::Exception::BadResponseFromService - When http fails

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::BadResponseFromService is thrown when http calls to web services fail. It does OpenGbg::Execption.

ATTRIBUTES

service

The name of the service that was called (eg. OpenGbg::Service::StyrOchStall::get_bike_stations).

url

String. The responding url.

status

String. The http error code.

reason

String. The http error message.

AUTHOR

Erik Carlsson <info@code301.com>

COPYRIGHT

Copyright 2014 - Erik Carlsson

LICENSE

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