line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package GeoIP2::Error::HTTP; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
24
|
|
4
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
31
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '2.006002'; |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
5
|
use Moo; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
267
|
use namespace::clean -except => 'meta'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
10
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
with 'GeoIP2::Role::Error::HTTP'; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
extends 'Throwable::Error'; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
1; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# ABSTRACT: An HTTP transport error |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
__END__ |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=pod |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=encoding UTF-8 |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 NAME |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
GeoIP2::Error::HTTP - An HTTP transport error |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 VERSION |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
version 2.006002 |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 SYNOPSIS |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
use 5.008; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
use GeoIP2::WebService::Client; |
39
|
|
|
|
|
|
|
use Scalar::Util qw( blessed ); |
40
|
|
|
|
|
|
|
use Try::Tiny; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
my $client = GeoIP2::WebService::Client->new( |
43
|
|
|
|
|
|
|
account_id => 42, |
44
|
|
|
|
|
|
|
license_key => 'abcdef123456', |
45
|
|
|
|
|
|
|
); |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
try { |
48
|
|
|
|
|
|
|
$client->insights( ip => '24.24.24.24' ); |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
catch { |
51
|
|
|
|
|
|
|
die $_ unless blessed $_; |
52
|
|
|
|
|
|
|
if ( $_->isa('GeoIP2::Error::HTTP') ) { |
53
|
|
|
|
|
|
|
log_http_error( |
54
|
|
|
|
|
|
|
status => $_->http_status(), |
55
|
|
|
|
|
|
|
uri => $_->uri(), |
56
|
|
|
|
|
|
|
); |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
# handle other exceptions |
60
|
|
|
|
|
|
|
}; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 DESCRIPTION |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
This class represents an HTTP transport error. It extends L<Throwable::Error> |
65
|
|
|
|
|
|
|
and adds attributes of its own. |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 METHODS |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
The C<< $error->message() >>, and C<< $error->stack_trace() >> methods are |
70
|
|
|
|
|
|
|
inherited from L<Throwable::Error>. It also provide two methods of its own: |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head2 $error->http_status() |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Returns the HTTP status. This should be either a 4xx or 5xx error. |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head2 $error->uri() |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
Returns the URI which gave the HTTP error. |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 SUPPORT |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Bugs may be submitted through L<https://github.com/maxmind/GeoIP2-perl/issues>. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 AUTHORS |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=over 4 |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=item * |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
Dave Rolsky <drolsky@maxmind.com> |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=item * |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
Greg Oschwald <goschwald@maxmind.com> |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=item * |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
Mark Fowler <mfowler@maxmind.com> |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=item * |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
Olaf Alders <oalders@maxmind.com> |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=back |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
This software is copyright (c) 2013 - 2019 by MaxMind, Inc. |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
111
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=cut |