| 1 | package GeoIP2::Error::Generic; | ||
| 2 | 2 | $GeoIP2::Error::Generic::VERSION = '0.050000'; | |
| 3 | 2 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 2 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 2 | ▶ | use Moo; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | 2 | extends 'Throwable::Error'; | |
| 9 | |||
| 10 | 2 | 1; | |
| 11 | |||
| 12 | # ABSTRACT: A generic exception | ||
| 13 | |||
| 14 | __END__ | ||
| 15 | |||
| 16 | =pod | ||
| 17 | |||
| 18 | =head1 NAME | ||
| 19 | |||
| 20 | GeoIP2::Error::Generic - A generic exception | ||
| 21 | |||
| 22 | =head1 VERSION | ||
| 23 | |||
| 24 | version 0.050000 | ||
| 25 | |||
| 26 | =head1 SYNOPSIS | ||
| 27 | |||
| 28 | use 5.008; | ||
| 29 | |||
| 30 | use GeoIP2::WebService::Client; | ||
| 31 | use Scalar::Util qw( blessed ); | ||
| 32 | use Try::Tiny; | ||
| 33 | |||
| 34 | my $client = GeoIP2::WebService::Client->new( | ||
| 35 | user_id => 42, | ||
| 36 | license_key => 'abcdef123456', | ||
| 37 | ); | ||
| 38 | |||
| 39 | try { | ||
| 40 | $client->insights( ip => '24.24.24.24' ); | ||
| 41 | } | ||
| 42 | catch { | ||
| 43 | die $_ unless blessed $_; | ||
| 44 | die $_ if $_->isa('GeoIP2::Error::Generic'); | ||
| 45 | |||
| 46 | # handle other exceptions | ||
| 47 | }; | ||
| 48 | |||
| 49 | =head1 DESCRIPTION | ||
| 50 | |||
| 51 | This class represents a generic error. It extends L<Throwable::Error> and does | ||
| 52 | not add any additional attributes. | ||
| 53 | |||
| 54 | =head1 METHODS | ||
| 55 | |||
| 56 | This class has two methods, C<< $error->message() >>, and C<< | ||
| 57 | $error->stack_trace() >>. Both methods are inherited from L<Throwable::Error>. | ||
| 58 | |||
| 59 | =head1 AUTHORS | ||
| 60 | |||
| 61 | =over 4 | ||
| 62 | |||
| 63 | =item * | ||
| 64 | |||
| 65 | Dave Rolsky <drolsky@maxmind.com> | ||
| 66 | |||
| 67 | =item * | ||
| 68 | |||
| 69 | Greg Oschwald <goschwald@maxmind.com> | ||
| 70 | |||
| 71 | =item * | ||
| 72 | |||
| 73 | Olaf Alders <oalders@maxmind.com> | ||
| 74 | |||
| 75 | =back | ||
| 76 | |||
| 77 | =head1 COPYRIGHT AND LICENSE | ||
| 78 | |||
| 79 | This software is copyright (c) 2014 by MaxMind, Inc.. | ||
| 80 | |||
| 81 | This is free software; you can redistribute it and/or modify it under | ||
| 82 | the same terms as the Perl 5 programming language system itself. | ||
| 83 | |||
| 84 | =cut | ||