1GeoIP2::Error::HTTP(3)User Contributed Perl DocumentationGeoIP2::Error::HTTP(3)
2
3
4

NAME

6       GeoIP2::Error::HTTP - An HTTP transport error
7

VERSION

9       version 2.006002
10

SYNOPSIS

12         use 5.008;
13
14         use GeoIP2::WebService::Client;
15         use Scalar::Util qw( blessed );
16         use Try::Tiny;
17
18         my $client = GeoIP2::WebService::Client->new(
19             account_id  => 42,
20             license_key => 'abcdef123456',
21         );
22
23         try {
24             $client->insights( ip => '24.24.24.24' );
25         }
26         catch {
27             die $_ unless blessed $_;
28             if ( $_->isa('GeoIP2::Error::HTTP') ) {
29                 log_http_error(
30                     status => $_->http_status(),
31                     uri    => $_->uri(),
32                 );
33             }
34
35             # handle other exceptions
36         };
37

DESCRIPTION

39       This class represents an HTTP transport error. It extends
40       Throwable::Error and adds attributes of its own.
41

METHODS

43       The "$error->message()", and "$error->stack_trace()" methods are
44       inherited from Throwable::Error. It also provide two methods of its
45       own:
46
47   $error->http_status()
48       Returns the HTTP status. This should be either a 4xx or 5xx error.
49
50   $error->uri()
51       Returns the URI which gave the HTTP error.
52

SUPPORT

54       Bugs may be submitted through
55       <https://github.com/maxmind/GeoIP2-perl/issues>.
56

AUTHORS

58       •   Dave Rolsky <drolsky@maxmind.com>
59
60       •   Greg Oschwald <goschwald@maxmind.com>
61
62       •   Mark Fowler <mfowler@maxmind.com>
63
64       •   Olaf Alders <oalders@maxmind.com>
65
67       This software is copyright (c) 2013 - 2019 by MaxMind, Inc.
68
69       This is free software; you can redistribute it and/or modify it under
70       the same terms as the Perl 5 programming language system itself.
71
72
73
74perl v5.34.0                      2021-07-22            GeoIP2::Error::HTTP(3)
Impressum