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

filter: Statementstmt 100% 22 / 22 Branchbran 100% 6 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod n/a totaltotal 100% 31 / 31 CC 4 SCAR 11.0
CC
4
Cov
100%
__ANON__
4.0
BEGIN
1.0
BEGIN
1.0
CRAP 3.0
« Net/Amazon/S3/Operation/Bucket/Acl/Set/Request.pm ↑ Summary Net/Amazon/S3/Request.pm »
1 package Net::Amazon::S3::Error::Handler::Legacy;
2 99 $Net::Amazon::S3::Error::Handler::Legacy::VERSION = '0.992';
3 # ABSTRACT: An internal class to report errors like legacy API
4  
5 99 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 99 extends 'Net::Amazon::S3::Error::Handler::Status';
8  
9 99 ▶use HTTP::Status;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 99 our @CARP_NOT = __PACKAGE__;
12  
13 99 my %croak_on_response = map +($_ => 1), (
14 'Net::Amazon::S3::Operation::Bucket::Acl::Fetch::Response',
15 'Net::Amazon::S3::Operation::Object::Acl::Fetch::Response',
16 'Net::Amazon::S3::Operation::Object::Fetch::Response',
17 );
18  
19 103 ▶override handle_error => sub {
Subroutine __ANON__: called CC=4 SCAR=13.9
20 103 my ($self, $response, $request) = @_;
21  
22 103 ▶ return super unless exists $croak_on_response{ref $response};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $croak_on_response{ref $response} 82 21 103
23  
24 21 $self->s3->err (undef);
25 21 $self->s3->errstr (undef);
26  
27 21 ▶ return 1 unless $response->is_error;
Branch: 1 branch
BranchTrueFalseTotal
unless $response->is_error 5 16 21
28 16 ▶ return 0 if $response->http_response->code == HTTP::Status::HTTP_NOT_FOUND;
Branch: 1 branch
BranchTrueFalseTotal
if $response->http_response->code == 404 7 9 16
29  
30 9 $self->s3->err ("network_error");
31 9 $self->s3->errstr ($response->http_response->status_line);
32  
33 9 Carp::croak ("Net::Amazon::S3: Amazon responded with ${\ $self->s3->errstr }\n");
34 99 };
35  
36 99 1;
37  
38 __END__
« Net/Amazon/S3/Operation/Bucket/Acl/Set/Request.pm ↑ Summary Net/Amazon/S3/Request.pm »