| 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
| |||||||||||
| 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
| |||||||||||
| 28 | 16 | ▶ | return 0 if $response->http_response->code == HTTP::Status::HTTP_NOT_FOUND; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 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__ | ||||||||||