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