File Coverage

blib/lib/WebService/PayPal/PaymentsAdvanced/Error/Generic.pm
Criterion Covered Total %
statement 6 6 100.0
branch n/a
condition n/a
subroutine 2 2 100.0
pod n/a
total 8 8 100.0


line stmt bran cond sub pod time code
1             package WebService::PayPal::PaymentsAdvanced::Error::Generic;
2              
3 8     8   69 use Moo;
  8         20  
  8         87  
4              
5 8     8   2897 use namespace::autoclean;
  8         32  
  8         82  
6              
7             our $VERSION = '0.000026';
8              
9             with 'WebService::PayPal::PaymentsAdvanced::Role::HasParams';
10              
11             extends 'Throwable::Error';
12              
13             1;
14              
15             # ABSTRACT: A generic error
16              
17             __END__
18              
19             =pod
20              
21             =head1 NAME
22              
23             WebService::PayPal::PaymentsAdvanced::Error::Generic - A generic error
24              
25             =head1 VERSION
26              
27             version 0.000026
28              
29             =head1 SYNOPSIS
30              
31             use Try::Tiny;
32             use WebService::PayPal::PaymentsAdvanced;
33             my $payments = WebService::PayPal::PaymentsAdvanced->new(...);
34              
35             try {
36             $payments->create_secure_token(...);
37             }
38             catch {
39             die $_ unless blessed $_;
40             if ( $_->isa('WebService::PayPal::PaymentsAdvanced::Error::Generic') )
41             {
42             log_generic_error(
43             message => $_->message,
44             params => $_->params,
45             );
46             }
47              
48             # handle other exceptions
49             };
50              
51             =head1 DESCRIPTION
52              
53             This class represents a generic error. It extends L<Throwable::Error>
54             and adds one attribute of its own.
55              
56             =head1 METHODS
57              
58             The C<< $error->message() >>, and C<< $error->stack_trace() >> methods are
59             inherited from L<Throwable::Error>.
60              
61             =head2 params
62              
63             Returns a C<HashRef> of params which was received from PayPal.
64              
65             =head1 AUTHOR
66              
67             Olaf Alders <olaf@wundercounter.com>
68              
69             =head1 COPYRIGHT AND LICENSE
70              
71             This software is copyright (c) 2020 by MaxMind, Inc.
72              
73             This is free software; you can redistribute it and/or modify it under
74             the same terms as the Perl 5 programming language system itself.
75              
76             =cut