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   62 use Moo;
  8         22  
  8         70  
4              
5 8     8   2802 use namespace::autoclean;
  8         21  
  8         69  
6              
7             our $VERSION = '0.000027';
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             =encoding UTF-8
22              
23             =head1 NAME
24              
25             WebService::PayPal::PaymentsAdvanced::Error::Generic - A generic error
26              
27             =head1 VERSION
28              
29             version 0.000027
30              
31             =head1 SYNOPSIS
32              
33             use Try::Tiny;
34             use WebService::PayPal::PaymentsAdvanced;
35             my $payments = WebService::PayPal::PaymentsAdvanced->new(...);
36              
37             try {
38             $payments->create_secure_token(...);
39             }
40             catch {
41             die $_ unless blessed $_;
42             if ( $_->isa('WebService::PayPal::PaymentsAdvanced::Error::Generic') )
43             {
44             log_generic_error(
45             message => $_->message,
46             params => $_->params,
47             );
48             }
49              
50             # handle other exceptions
51             };
52              
53             =head1 DESCRIPTION
54              
55             This class represents a generic error. It extends L<Throwable::Error>
56             and adds one attribute of its own.
57              
58             =head1 METHODS
59              
60             The C<< $error->message() >>, and C<< $error->stack_trace() >> methods are
61             inherited from L<Throwable::Error>.
62              
63             =head2 params
64              
65             Returns a C<HashRef> of params which was received from PayPal.
66              
67             =head1 SUPPORT
68              
69             Bugs may be submitted through L<https://github.com/maxmind/webservice-paypal-paymentsadvanced/issues>.
70              
71             =head1 AUTHOR
72              
73             Olaf Alders <olaf@wundercounter.com>
74              
75             =head1 COPYRIGHT AND LICENSE
76              
77             This software is copyright (c) 2021 by MaxMind, Inc.
78              
79             This is free software; you can redistribute it and/or modify it under
80             the same terms as the Perl 5 programming language system itself.
81              
82             =cut