| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Net::Async::Webservice::UPS::Exception; | 
| 2 |  |  |  |  |  |  | $Net::Async::Webservice::UPS::Exception::VERSION = '1.1.4'; | 
| 3 |  |  |  |  |  |  | { | 
| 4 |  |  |  |  |  |  | $Net::Async::Webservice::UPS::Exception::DIST = 'Net-Async-Webservice-UPS'; | 
| 5 |  |  |  |  |  |  | } | 
| 6 | 4 |  |  | 4 |  | 19 | use strict; | 
|  | 4 |  |  |  |  | 4 |  | 
|  | 4 |  |  |  |  | 232 |  | 
| 7 |  |  |  |  |  |  |  | 
| 8 |  |  |  |  |  |  |  | 
| 9 |  |  |  |  |  |  | {package Net::Async::Webservice::UPS::Exception::BadPackage; | 
| 10 |  |  |  |  |  |  | $Net::Async::Webservice::UPS::Exception::BadPackage::VERSION = '1.1.4'; | 
| 11 |  |  |  |  |  |  | { | 
| 12 |  |  |  |  |  |  | $Net::Async::Webservice::UPS::Exception::BadPackage::DIST = 'Net-Async-Webservice-UPS'; | 
| 13 |  |  |  |  |  |  | } | 
| 14 | 4 |  |  | 4 |  | 17 | use Moo; | 
|  | 4 |  |  |  |  | 5 |  | 
|  | 4 |  |  |  |  | 38 |  | 
| 15 |  |  |  |  |  |  | extends 'Net::Async::Webservice::Common::Exception'; | 
| 16 | 4 |  |  | 4 |  | 1153 | use namespace::autoclean; | 
|  | 4 |  |  |  |  | 10 |  | 
|  | 4 |  |  |  |  | 34 |  | 
| 17 |  |  |  |  |  |  |  | 
| 18 |  |  |  |  |  |  |  | 
| 19 |  |  |  |  |  |  | has package => ( is => 'ro', required => 1 ); | 
| 20 |  |  |  |  |  |  |  | 
| 21 |  |  |  |  |  |  |  | 
| 22 |  |  |  |  |  |  | sub as_string { | 
| 23 | 0 |  |  | 0 | 1 |  | my ($self) = @_; | 
| 24 |  |  |  |  |  |  |  | 
| 25 | 0 |  | 0 |  |  |  | return sprintf 'Package size/weight not supported: %fx%fx%f %s %f %s, at %s', | 
|  |  |  | 0 |  |  |  |  | 
|  |  |  | 0 |  |  |  |  | 
|  |  |  | 0 |  |  |  |  | 
| 26 |  |  |  |  |  |  | $self->package->length//'<undef>', | 
| 27 |  |  |  |  |  |  | $self->package->width//'<undef>', | 
| 28 |  |  |  |  |  |  | $self->package->height//'<undef>', | 
| 29 |  |  |  |  |  |  | $self->package->linear_unit, | 
| 30 |  |  |  |  |  |  | $self->package->weight//'<undef>', | 
| 31 |  |  |  |  |  |  | $self->package->weight_unit, | 
| 32 |  |  |  |  |  |  | $self->stack_trace->as_string; | 
| 33 |  |  |  |  |  |  | } | 
| 34 |  |  |  |  |  |  | } | 
| 35 |  |  |  |  |  |  |  | 
| 36 |  |  |  |  |  |  | {package Net::Async::Webservice::UPS::Exception::UPSError; | 
| 37 |  |  |  |  |  |  | $Net::Async::Webservice::UPS::Exception::UPSError::VERSION = '1.1.4'; | 
| 38 |  |  |  |  |  |  | { | 
| 39 |  |  |  |  |  |  | $Net::Async::Webservice::UPS::Exception::UPSError::DIST = 'Net-Async-Webservice-UPS'; | 
| 40 |  |  |  |  |  |  | } | 
| 41 | 4 |  |  | 4 |  | 30776 | use Moo; | 
|  | 4 |  |  |  |  | 7 |  | 
|  | 4 |  |  |  |  | 17 |  | 
| 42 |  |  |  |  |  |  | extends 'Net::Async::Webservice::Common::Exception'; | 
| 43 | 4 |  |  | 4 |  | 1230 | use namespace::autoclean; | 
|  | 4 |  |  |  |  | 8 |  | 
|  | 4 |  |  |  |  | 22 |  | 
| 44 |  |  |  |  |  |  |  | 
| 45 |  |  |  |  |  |  |  | 
| 46 |  |  |  |  |  |  | has error => ( is => 'ro', required => 1 ); | 
| 47 |  |  |  |  |  |  |  | 
| 48 |  |  |  |  |  |  |  | 
| 49 | 0 |  |  | 0 | 0 |  | sub error_description { $_[0]->error->{ErrorDescription} } | 
| 50 | 0 |  |  | 0 | 0 |  | sub error_severity { $_[0]->error->{ErrorSeverity} } | 
| 51 | 0 |  |  | 0 | 0 |  | sub error_code { $_[0]->error->{ErrorCode} } | 
| 52 | 0 |  |  | 0 | 0 |  | sub error_location { $_[0]->error->{ErrorLocation} } | 
| 53 | 0 |  |  | 0 | 0 |  | sub retry_seconds { $_[0]->error->{MinimumRetrySeconds} } | 
| 54 |  |  |  |  |  |  |  | 
| 55 |  |  |  |  |  |  | sub _error_location_str { | 
| 56 | 0 |  |  | 0 |  |  | my ($self) = @_; | 
| 57 | 0 |  |  |  |  |  | my $el = $self->error_location; | 
| 58 | 0 | 0 |  |  |  |  | if ($el->{ErrorLocationElementName}) { | 
|  |  | 0 |  |  |  |  |  | 
| 59 | 0 |  |  |  |  |  | return "element ".$el->{ErrorLocationElementName}; | 
| 60 |  |  |  |  |  |  | } | 
| 61 |  |  |  |  |  |  | elsif ($el->{ErrorLocationAttributeName}) { | 
| 62 | 0 |  |  |  |  |  | return "attribute ".$el->{ErrorLocationAttributeName}; | 
| 63 |  |  |  |  |  |  | } | 
| 64 |  |  |  |  |  |  | else { | 
| 65 | 0 |  |  |  |  |  | return; | 
| 66 |  |  |  |  |  |  | } | 
| 67 |  |  |  |  |  |  | } | 
| 68 |  |  |  |  |  |  |  | 
| 69 |  |  |  |  |  |  |  | 
| 70 |  |  |  |  |  |  | sub as_string { | 
| 71 | 0 |  |  | 0 | 1 |  | my ($self) = @_; | 
| 72 |  |  |  |  |  |  |  | 
| 73 | 0 |  | 0 |  |  |  | return sprintf 'UPS returned an error: %s, severity %s, code %s, location %s, at %s', | 
|  |  |  | 0 |  |  |  |  | 
|  |  |  | 0 |  |  |  |  | 
|  |  |  | 0 |  |  |  |  | 
| 74 |  |  |  |  |  |  | $self->error_description//'<undef>', | 
| 75 |  |  |  |  |  |  | $self->error_severity//'<undef>', | 
| 76 |  |  |  |  |  |  | $self->error_code//'<undef>', | 
| 77 |  |  |  |  |  |  | $self->_error_location_str//'<undef>', | 
| 78 |  |  |  |  |  |  | $self->stack_trace->as_string; | 
| 79 |  |  |  |  |  |  | } | 
| 80 |  |  |  |  |  |  | } | 
| 81 |  |  |  |  |  |  |  | 
| 82 |  |  |  |  |  |  | 1; | 
| 83 |  |  |  |  |  |  |  | 
| 84 |  |  |  |  |  |  | __END__ | 
| 85 |  |  |  |  |  |  |  | 
| 86 |  |  |  |  |  |  | =pod | 
| 87 |  |  |  |  |  |  |  | 
| 88 |  |  |  |  |  |  | =encoding UTF-8 | 
| 89 |  |  |  |  |  |  |  | 
| 90 |  |  |  |  |  |  | =head1 NAME | 
| 91 |  |  |  |  |  |  |  | 
| 92 |  |  |  |  |  |  | Net::Async::Webservice::UPS::Exception | 
| 93 |  |  |  |  |  |  |  | 
| 94 |  |  |  |  |  |  | =head1 VERSION | 
| 95 |  |  |  |  |  |  |  | 
| 96 |  |  |  |  |  |  | version 1.1.4 | 
| 97 |  |  |  |  |  |  |  | 
| 98 |  |  |  |  |  |  | =head1 DESCRIPTION | 
| 99 |  |  |  |  |  |  |  | 
| 100 |  |  |  |  |  |  | These classes are based on L<Throwable> and L<StackTrace::Auto>. The | 
| 101 |  |  |  |  |  |  | L</as_string> method should return something readable, with a full | 
| 102 |  |  |  |  |  |  | stack trace. Their base class is | 
| 103 |  |  |  |  |  |  | L<Net::Async::Webservice::Common::Exception>. | 
| 104 |  |  |  |  |  |  |  | 
| 105 |  |  |  |  |  |  | =head1 NAME | 
| 106 |  |  |  |  |  |  |  | 
| 107 |  |  |  |  |  |  | Net::Async::Webservice::UPS::Exception - exception classes for UPS | 
| 108 |  |  |  |  |  |  |  | 
| 109 |  |  |  |  |  |  | =head1 Classes | 
| 110 |  |  |  |  |  |  |  | 
| 111 |  |  |  |  |  |  | =head2 C<Net::Async::Webservice::UPS::Exception::BadPackage> | 
| 112 |  |  |  |  |  |  |  | 
| 113 |  |  |  |  |  |  | exception thrown when a package is too big for UPS to carry | 
| 114 |  |  |  |  |  |  |  | 
| 115 |  |  |  |  |  |  | =head3 Attributes | 
| 116 |  |  |  |  |  |  |  | 
| 117 |  |  |  |  |  |  | =head4 C<package> | 
| 118 |  |  |  |  |  |  |  | 
| 119 |  |  |  |  |  |  | The package object that's too big. | 
| 120 |  |  |  |  |  |  |  | 
| 121 |  |  |  |  |  |  | =head3 Methods | 
| 122 |  |  |  |  |  |  |  | 
| 123 |  |  |  |  |  |  | =head4 C<as_string> | 
| 124 |  |  |  |  |  |  |  | 
| 125 |  |  |  |  |  |  | Shows the size of the package, and the stack trace. | 
| 126 |  |  |  |  |  |  |  | 
| 127 |  |  |  |  |  |  | =head2 C<Net::Async::Webservice::UPS::Exception::UPSError> | 
| 128 |  |  |  |  |  |  |  | 
| 129 |  |  |  |  |  |  | exception thrown when UPS signals an error | 
| 130 |  |  |  |  |  |  |  | 
| 131 |  |  |  |  |  |  | =head3 Attributes | 
| 132 |  |  |  |  |  |  |  | 
| 133 |  |  |  |  |  |  | =head4 C<error> | 
| 134 |  |  |  |  |  |  |  | 
| 135 |  |  |  |  |  |  | The error data structure extracted from the UPS response. | 
| 136 |  |  |  |  |  |  |  | 
| 137 |  |  |  |  |  |  | =head3 Methods | 
| 138 |  |  |  |  |  |  |  | 
| 139 |  |  |  |  |  |  | =head4 C<error_description> | 
| 140 |  |  |  |  |  |  |  | 
| 141 |  |  |  |  |  |  | =head4 C<error_severity> | 
| 142 |  |  |  |  |  |  |  | 
| 143 |  |  |  |  |  |  | =head4 C<error_code> | 
| 144 |  |  |  |  |  |  |  | 
| 145 |  |  |  |  |  |  | =head4 C<error_location> | 
| 146 |  |  |  |  |  |  |  | 
| 147 |  |  |  |  |  |  | =head4 C<retry_seconds> | 
| 148 |  |  |  |  |  |  |  | 
| 149 |  |  |  |  |  |  | These just return the similarly-named fields from inside L</error>: | 
| 150 |  |  |  |  |  |  | C<ErrorDescription>, C<ErrorSeverity>, C<ErrorCode>, C<ErrorLocation>, | 
| 151 |  |  |  |  |  |  | C<MinimumRetrySeconds>. | 
| 152 |  |  |  |  |  |  |  | 
| 153 |  |  |  |  |  |  | =head4 C<as_string> | 
| 154 |  |  |  |  |  |  |  | 
| 155 |  |  |  |  |  |  | Mentions the description, severity, and code of the error, plus the | 
| 156 |  |  |  |  |  |  | stack trace. | 
| 157 |  |  |  |  |  |  |  | 
| 158 |  |  |  |  |  |  | =head1 AUTHORS | 
| 159 |  |  |  |  |  |  |  | 
| 160 |  |  |  |  |  |  | =over 4 | 
| 161 |  |  |  |  |  |  |  | 
| 162 |  |  |  |  |  |  | =item * | 
| 163 |  |  |  |  |  |  |  | 
| 164 |  |  |  |  |  |  | Gianni Ceccarelli <gianni.ceccarelli@net-a-porter.com> | 
| 165 |  |  |  |  |  |  |  | 
| 166 |  |  |  |  |  |  | =item * | 
| 167 |  |  |  |  |  |  |  | 
| 168 |  |  |  |  |  |  | Sherzod B. Ruzmetov <sherzodr@cpan.org> | 
| 169 |  |  |  |  |  |  |  | 
| 170 |  |  |  |  |  |  | =back | 
| 171 |  |  |  |  |  |  |  | 
| 172 |  |  |  |  |  |  | =head1 COPYRIGHT AND LICENSE | 
| 173 |  |  |  |  |  |  |  | 
| 174 |  |  |  |  |  |  | This software is copyright (c) 2015 by Gianni Ceccarelli <gianni.ceccarelli@net-a-porter.com>. | 
| 175 |  |  |  |  |  |  |  | 
| 176 |  |  |  |  |  |  | This is free software; you can redistribute it and/or modify it under | 
| 177 |  |  |  |  |  |  | the same terms as the Perl 5 programming language system itself. | 
| 178 |  |  |  |  |  |  |  | 
| 179 |  |  |  |  |  |  | =cut |