Heray-Was-Here
Server : Apache
System : Linux vps103298.mylogin.co 4.18.0-513.11.1.el8_9.x86_64 #1 SMP Wed Jan 17 02:00:40 EST 2024 x86_64
User : calvet ( 273824)
PHP Version : 7.4.33
Disable Function : NONE
Directory :  /usr/share/perl5/vendor_perl/Net/Amazon/S3/Error/Handler/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/share/perl5/vendor_perl/Net/Amazon/S3/Error/Handler/X.pm
package Net::Amazon::S3::Error::Handler::X;
$Net::Amazon::S3::Error::Handler::X::VERSION = '0.991';
# ABSTRACT: Throw error specific exception

use Moose;

extends 'Net::Amazon::S3::Error::Handler';

use Net::Amazon::S3::X;

override handle_error => sub {
	my ($self, $response, $request) = @_;

	return 1 unless $response->is_error;

	my $exception = Net::Amazon::S3::X->build (
		$response->error_code,
		request => $request,
		response => $response,
	);

	die $exception;
};

1;

__END__

=pod

=encoding UTF-8

=head1 NAME

Net::Amazon::S3::Error::Handler::X - Throw error specific exception

=head1 VERSION

version 0.991

=head1 DESCRIPTION

Raise error specific exception.

=head2 S3 error

For S3 errors exception it raises is instance of C<Net::Amazon::S3::X::error-code>.
AWS error code list can be found at L<https://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html#ErrorCodeList>

	my $s3 = Net::Amazon::S3->new (
		error_handler_class => 'Net::Amazon::S3::Error::Handler::X',
		...
	);

	eval { do s3 operation; 1 } or do {
		say 'access denied'
			if $@->$Safe::Isa::_isa ('Net::Amazon::S3::X::AccessDenied');
		...
	};

=head1 AUTHOR

Branislav Zahradník <barney@cpan.org>

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2022 by Amazon Digital Services, Leon Brocard, Brad Fitzpatrick, Pedro Figueiredo, Rusty Conover, Branislav Zahradník.

This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.

=cut

Hry