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