File Coverage

blib/lib/Net/Amazon/S3/Error/Handler/Confess.pm
Criterion Covered Total %
statement 15 15 100.0
branch 4 4 100.0
condition 3 3 100.0
subroutine 4 4 100.0
pod 1 1 100.0
total 27 27 100.0


line stmt bran cond sub pod time code
1             package Net::Amazon::S3::Error::Handler::Confess;
2             $Net::Amazon::S3::Error::Handler::Confess::VERSION = '0.99';
3             # ABSTRACT: An internal class to report errors via Carp::confess
4              
5 99     99   793 use Moose;
  99         238  
  99         773  
6 99     99   672660 use Carp;
  99         301  
  99         7199  
7 99     99   736 use HTTP::Status;
  99         260  
  99         55652  
8              
9             extends 'Net::Amazon::S3::Error::Handler';
10              
11             our @CARP_NOT = (__PACKAGE__);
12              
13             my %return_false = (
14             NoSuchKey => {
15             'Net::Amazon::S3::Operation::Object::Head::Response' => 1,
16             },
17             NoSuchBucket => {
18             'Net::Amazon::S3::Operation::Object::Head::Response' => 1,
19             },
20             '404' => {
21             'Net::Amazon::S3::Operation::Object::Head::Response' => 1,
22             },
23             );
24              
25             sub handle_error {
26 99     99 1 333 my ($self, $response) = @_;
27              
28 99 100       566 return 1 unless $response->is_error;
29              
30             return 0
31             if exists $return_false{ $response->error_code }
32 57 100 100     2435 && exists $return_false{ $response->error_code }{ ref $response }
33             ;
34              
35 55         158 Carp::confess ("${\ $response->error_code }: ${\ $response->error_message }");
  55         1568  
  55         1743  
36             }
37              
38             1;
39              
40             __END__
41              
42             =pod
43              
44             =encoding UTF-8
45              
46             =head1 NAME
47              
48             Net::Amazon::S3::Error::Handler::Confess - An internal class to report errors via Carp::confess
49              
50             =head1 VERSION
51              
52             version 0.99
53              
54             =head1 DESCRIPTION
55              
56             Carp::confess on error.
57              
58             =head1 AUTHOR
59              
60             Branislav ZahradnĂ­k <barney@cpan.org>
61              
62             =head1 COPYRIGHT AND LICENSE
63              
64             This software is copyright (c) 2021 by Amazon Digital Services, Leon Brocard, Brad Fitzpatrick, Pedro Figueiredo, Rusty Conover, Branislav ZahradnĂ­k.
65              
66             This is free software; you can redistribute it and/or modify it under
67             the same terms as the Perl 5 programming language system itself.
68              
69             =cut