1GeoIP2::Error::Type(3)User Contributed Perl DocumentationGeoIP2::Error::Type(3)
2
3
4
6 GeoIP2::Error::Type - A type validation error.
7
9 version 2.006002
10
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::Type') ) {
29 log_validation_error(
30 type => $_->name(),
31 value => $_->value(),
32 );
33 }
34
35 # handle other exceptions
36 };
37
39 This class represents a Moo type validation error. It extends
40 Throwable::Error and adds attributes of its own.
41
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->name()
48 Returns the name of the type which failed validation.
49
50 $error->value()
51 Returns the value which triggered the validation failure.
52
54 Bugs may be submitted through
55 <https://github.com/maxmind/GeoIP2-perl/issues>.
56
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.36.0 2023-01-20 GeoIP2::Error::Type(3)