line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::Amazon::S3::Error::Handler::Legacy; |
2
|
|
|
|
|
|
|
$Net::Amazon::S3::Error::Handler::Legacy::VERSION = '0.99'; |
3
|
|
|
|
|
|
|
# ABSTRACT: An internal class to report errors like legacy API |
4
|
|
|
|
|
|
|
|
5
|
99
|
|
|
99
|
|
817
|
use Moose; |
|
99
|
|
|
|
|
265
|
|
|
99
|
|
|
|
|
931
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
extends 'Net::Amazon::S3::Error::Handler::Status'; |
8
|
|
|
|
|
|
|
|
9
|
99
|
|
|
99
|
|
694790
|
use HTTP::Status; |
|
99
|
|
|
|
|
288
|
|
|
99
|
|
|
|
|
59791
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our @CARP_NOT = __PACKAGE__; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
override handle_error => sub { |
20
|
|
|
|
|
|
|
my ($self, $response, $request) = @_; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
return super unless exists $croak_on_response{ref $response}; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
$self->s3->err (undef); |
25
|
|
|
|
|
|
|
$self->s3->errstr (undef); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
return 1 unless $response->is_error; |
28
|
|
|
|
|
|
|
return 0 if $response->http_response->code == HTTP::Status::HTTP_NOT_FOUND; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
$self->s3->err ("network_error"); |
31
|
|
|
|
|
|
|
$self->s3->errstr ($response->http_response->status_line); |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
Carp::croak ("Net::Amazon::S3: Amazon responded with ${\ $self->s3->errstr }\n"); |
34
|
|
|
|
|
|
|
}; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
1; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
__END__ |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=pod |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=encoding UTF-8 |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 NAME |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
Net::Amazon::S3::Error::Handler::Legacy - An internal class to report errors like legacy API |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 VERSION |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
version 0.99 |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 DESCRIPTION |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Handle errors like L<Net::Amazon::S3> API does. |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
Carp::croak in case of I<object fetch>, I<object acl fetch>, and I<bucket acl fetch>. |
57
|
|
|
|
|
|
|
set C<err> / C<errstr> only otherwise. |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 AUTHOR |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
Branislav Zahradník <barney@cpan.org> |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
This software is copyright (c) 2021 by Amazon Digital Services, Leon Brocard, Brad Fitzpatrick, Pedro Figueiredo, Rusty Conover, Branislav Zahradník. |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
68
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=cut |