GeoIP2/Error/IPAddressNotFound.pm

filter: Statementstmt 100% 19 / 19 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod n/a totaltotal 100% 24 / 24 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« GeoIP2/Error/HTTP.pm ↑ Summary GeoIP2/Error/Type.pm »
1 package GeoIP2::Error::IPAddressNotFound;
2  
3 8 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 8 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 8 our $VERSION = '2.006000';
7  
8 8 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 8 ▶use GeoIP2::Types qw( Str );
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 8 ▶use namespace::clean -except => 'meta';
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 8 extends 'Throwable::Error';
15  
16 8 has ip_address => (
17 is => 'ro',
18 isa => Str,
19 required => 1,
20 );
21  
22 8 1;
23  
24 # ABSTRACT: An exception thrown when an IP address is not in the MaxMind GeoIP2 database
25  
26 __END__
27  
28 =pod
29  
30 =encoding UTF-8
31  
32 =head1 NAME
33  
34 GeoIP2::Error::IPAddressNotFound - An exception thrown when an IP address is not in the MaxMind GeoIP2 database
35  
36 =head1 VERSION
37  
38 version 2.006000
39  
40 =head1 SYNOPSIS
41  
42 use 5.008;
43  
44 use GeoIP2::WebService::Client;
45 use Scalar::Util qw( blessed );
46 use Try::Tiny;
47  
48 my $client = GeoIP2::WebService::Client->new(
49 account_id => 42,
50 license_key => 'abcdef123456',
51 );
52  
53 try {
54 $client->insights( ip => '24.24.24.24' );
55 }
56 catch {
57 die $_ unless blessed $_;
58 if ( $_->isa('GeoIP2::Error::IPAddressNotFound') ) {
59 log_ip_address_not_found_error( ip_address => $_->ip_address() );
60 }
61  
62 # handle other exceptions
63 };
64  
65 =head1 DESCRIPTION
66  
67 This class represents an error that occurs when an IP address is not found in
68 the MaxMind GeoIP2 database, either through a web service or a local database.
69  
70 =head1 METHODS
71  
72 The C<< $error->message() >>, and C<< $error->stack_trace() >> methods are
73 inherited from L<Throwable::Error>. It also provide two methods of its own:
74  
75 =head2 $error->ip_address()
76  
77 Returns the IP address that could not be found.
78  
79 =head1 SUPPORT
80  
81 =head1 AUTHORS
82  
83 =over 4
84  
85 =item *
86  
87 Dave Rolsky <drolsky@maxmind.com>
88  
89 =item *
90  
91 Greg Oschwald <goschwald@maxmind.com>
92  
93 =item *
94  
95 Mark Fowler <mfowler@maxmind.com>
96  
97 =item *
98  
99 Olaf Alders <oalders@maxmind.com>
100  
101 =back
102  
103 =head1 COPYRIGHT AND LICENSE
104  
105 This software is copyright (c) 2013 - 2018 by MaxMind, Inc.
106  
107 This is free software; you can redistribute it and/or modify it under
108 the same terms as the Perl 5 programming language system itself.
109  
110 =cut
« GeoIP2/Error/HTTP.pm ↑ Summary GeoIP2/Error/Type.pm »