| 1 | package Net::Amazon::EC2::Errors; | ||
| 2 | 2 | $Net::Amazon::EC2::Errors::VERSION = '0.36'; | |
| 3 | 2 | ▶ | use Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | =head1 NAME | ||
| 6 | |||
| 7 | Net::Amazon::EC2::Errors | ||
| 8 | |||
| 9 | =head1 DESCRIPTION | ||
| 10 | |||
| 11 | A class representing one or more errors from an API request. | ||
| 12 | |||
| 13 | =head1 ATTRIBUTES | ||
| 14 | |||
| 15 | =over | ||
| 16 | |||
| 17 | =item request_id (required) | ||
| 18 | |||
| 19 | The ID of the request associated with this error. | ||
| 20 | |||
| 21 | =item errors (required) | ||
| 22 | |||
| 23 | An array ref of Net::Amazon::EC2::Error objects associated with this request. | ||
| 24 | |||
| 25 | =cut | ||
| 26 | |||
| 27 | 2 | ▶ | use overload '""' => 'as_string'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 28 | |||
| 29 | 2 | has 'request_id' => ( is => 'ro', isa => 'Str', required => 1 ); | |
| 30 | 2 | has 'errors' => ( | |
| 31 | is => 'rw', | ||
| 32 | isa => 'ArrayRef[Net::Amazon::EC2::Error]', | ||
| 33 | predicate => 'has_errors', | ||
| 34 | required => 1, | ||
| 35 | ); | ||
| 36 | |||
| 37 | 2 | ▶ | sub as_string { |
|
Subroutine
as_string: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 38 | 2 | my $self = shift; | |
| 39 | 2 | my $errors = join '', map { '['.$_->code.'] '.$_->message."\n" } @{$self->errors}; | |
| 40 | 2 | return "Amazon EC2 Errors [Request ".$self->request_id."]:\n$errors" | |
| 41 | } | ||
| 42 | |||
| 43 | 2 | __PACKAGE__->meta->make_immutable(); | |
| 44 | |||
| 45 | =back | ||
| 46 | |||
| 47 | =head1 AUTHOR | ||
| 48 | |||
| 49 | Jeff Kim <cpan@chosec.com> | ||
| 50 | |||
| 51 | =head1 COPYRIGHT | ||
| 52 | |||
| 53 | Copyright (c) 2006-2010 Jeff Kim. This program is free software; you can redistribute it and/or modify it | ||
| 54 | under the same terms as Perl itself. | ||
| 55 | |||
| 56 | =cut | ||
| 57 | |||
| 58 | 2 | ▶ | no Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 59 | 2 | 1; | |