Net/Amazon/S3/Error/Handler/Confess.pm

filter: Statementstmt 100% 20 / 20 Branchbran 100% 4 / 4 Conditioncond 100% 3 / 3 MC/DCmcdc 100% 2 / 2 Subroutinesub 100% 4 / 4 Podpod 100% 1 / 1 totaltotal 100% 34 / 34 SCAR 13.9
CC
4
Cov
100%
handle_error
4.0
BEGIN
1.0
BEGIN
1.0
CRAP 4.0
« Net/Amazon/S3/Client.pm ↑ Summary Net/Amazon/S3/Error/Handler/Legacy.pm »
1 package Net::Amazon::S3::Error::Handler::Confess;
2 99 $Net::Amazon::S3::Error::Handler::Confess::VERSION = '0.991';
3 # ABSTRACT: An internal class to report errors via Carp::confess
4  
5 99 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 99 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 99 ▶use HTTP::Status;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 99 extends 'Net::Amazon::S3::Error::Handler';
10  
11 99 our @CARP_NOT = (__PACKAGE__);
12  
13 99 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 ▶ my ($self, $response) = @_;
Subroutine handle_error: called CC=4 SCAR=13.9
Pod documented
27  
28 99 ▶ return 1 unless $response->is_error;
Branch: 1 branch
BranchTrueFalseTotal
unless $response->is_error 42 57 99
29  
30 return 0
31 if exists $return_false{ $response->error_code }
32 57 ▶ && exists $return_false{ $response->error_code }{ ref $response }
Branch: 1 branch
BranchTrueFalseTotal
if exists $return_false{$response->error_code} and exists $return_false{$response->error_code}{ref $response} 2 55 57
Condition100%3/3
exists $return_false{$response->error_code} and exists $return_false{$response->error_code}{ref $response}
!ll&&!rl&&r
37182
MC/DC100%2/2
exists $return_false{$response->error_code} and exists $return_false{$response->error_code}{ref $response}
exists $return_false{$response->error_code} exists $return_false{$response->error_code}{ref $response}
Truth table100%3/3
A and B
A= exists $return_false{$response->error_code}B= exists $return_false{$response->error_code}{ref $response}
ABresult
0X0
100
111
33 ;
34  
35 55 Carp::confess ("${\ $response->error_code }: ${\ $response->error_message }");
36 }
37  
38 99 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.991
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) 2022 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
« Net/Amazon/S3/Client.pm ↑ Summary Net/Amazon/S3/Error/Handler/Legacy.pm »