line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::Amazon::S3::Error::Handler::X; |
2
|
|
|
|
|
|
|
$Net::Amazon::S3::Error::Handler::X::VERSION = '0.99'; |
3
|
|
|
|
|
|
|
# ABSTRACT: Throw error specific exception |
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
506
|
use Moose; |
|
1
|
|
|
|
|
10
|
|
|
1
|
|
|
|
|
6
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
extends 'Net::Amazon::S3::Error::Handler'; |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
6441
|
use Net::Amazon::S3::X; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
override handle_error => sub { |
12
|
|
|
|
|
|
|
my ($self, $response, $request) = @_; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
return 1 unless $response->is_error; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
my $exception = Net::Amazon::S3::X->build ( |
17
|
|
|
|
|
|
|
$response->error_code, |
18
|
|
|
|
|
|
|
request => $request, |
19
|
|
|
|
|
|
|
response => $response, |
20
|
|
|
|
|
|
|
); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
die $exception; |
23
|
|
|
|
|
|
|
}; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
1; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
__END__ |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=pod |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=encoding UTF-8 |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 NAME |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
Net::Amazon::S3::Error::Handler::X - Throw error specific exception |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 VERSION |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
version 0.99 |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 DESCRIPTION |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
Raise error specific exception. |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head2 S3 error |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
For S3 errors exception it raises is instance of C<Net::Amazon::S3::X::error-code>. |
48
|
|
|
|
|
|
|
AWS error code list can be found at L<https://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html#ErrorCodeList> |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
my $s3 = Net::Amazon::S3->new ( |
51
|
|
|
|
|
|
|
error_handler_class => 'Net::Amazon::S3::Error::Handler::X', |
52
|
|
|
|
|
|
|
... |
53
|
|
|
|
|
|
|
); |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
eval { do s3 operation; 1 } or do { |
56
|
|
|
|
|
|
|
say 'access denied' |
57
|
|
|
|
|
|
|
if $@->$Safe::Isa::_isa ('Net::Amazon::S3::X::AccessDenied'); |
58
|
|
|
|
|
|
|
... |
59
|
|
|
|
|
|
|
}; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 AUTHOR |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
Branislav Zahradník <barney@cpan.org> |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
This software is copyright (c) 2021 by Amazon Digital Services, Leon Brocard, Brad Fitzpatrick, Pedro Figueiredo, Rusty Conover, Branislav Zahradník. |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
70
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=cut |