| 1 | ################################################################################ | ||||||||||||
| 2 | # Copyright 2008 Amazon Technologies, Inc. | ||||||||||||
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); | ||||||||||||
| 4 | # | ||||||||||||
| 5 | # You may not use this file except in compliance with the License. | ||||||||||||
| 6 | # You may obtain a copy of the License at: http://aws.amazon.com/apache2.0 | ||||||||||||
| 7 | # This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR | ||||||||||||
| 8 | # CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||||||||||||
| 9 | # specific language governing permissions and limitations under the License. | ||||||||||||
| 10 | ################################################################################ | ||||||||||||
| 11 | # __ _ _ ___ | ||||||||||||
| 12 | # ( )( \/\/ )/ __) | ||||||||||||
| 13 | # /__\ \ / \__ \ | ||||||||||||
| 14 | # (_)(_) \/\/ (___/ | ||||||||||||
| 15 | # | ||||||||||||
| 16 | # Amazon SQS Perl Library | ||||||||||||
| 17 | # API Version: 2009-02-01 | ||||||||||||
| 18 | # Generated: Thu Apr 09 01:13:11 PDT 2009 | ||||||||||||
| 19 | # | ||||||||||||
| 20 | |||||||||||||
| 21 | # | ||||||||||||
| 22 | # SQS Exception provides details of errors | ||||||||||||
| 23 | # returned by SQS service | ||||||||||||
| 24 | # | ||||||||||||
| 25 | package Amazon::SQS::Exception; | ||||||||||||
| 26 | |||||||||||||
| 27 | 3 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 28 | 3 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 29 | |||||||||||||
| 30 | # | ||||||||||||
| 31 | # Constructs Amazon::SQS::Exception | ||||||||||||
| 32 | # Accepts annonymous hash to construct the exception | ||||||||||||
| 33 | # | ||||||||||||
| 34 | # Keys are: | ||||||||||||
| 35 | # | ||||||||||||
| 36 | # Message - (string) text message for an exception | ||||||||||||
| 37 | # StatusCode - (int) HTTP status code at the time of exception | ||||||||||||
| 38 | # ErrorCode - (string) specific error code returned by the service | ||||||||||||
| 39 | # ErrorType - (string) Possible types: Sender, Receiver or Unknown | ||||||||||||
| 40 | # RequestId - (string) request id returned by the service | ||||||||||||
| 41 | # XML - (string) compete xml response at the time of exception | ||||||||||||
| 42 | # Exception - (Exception) inner exception if any | ||||||||||||
| 43 | # | ||||||||||||
| 44 | # | ||||||||||||
| 45 | # | ||||||||||||
| 46 | 0 | ▶ | sub new { | ||||||||||
|
Subroutine
new: not called CC=10 SCAR=47.0
Pod
undocumented
| |||||||||||||
| 47 | 0 | my ( $class, $errorInfo ) = @_; | |||||||||||
| 48 | |||||||||||||
| 49 | 0 | my $self = {}; | |||||||||||
| 50 | |||||||||||||
| 51 | 0 | ▶ | if ( exists( $errorInfo->{Exception} ) ) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 52 | 0 | my $exception = $errorInfo->{Exception}; | |||||||||||
| 53 | |||||||||||||
| 54 | 0 | ▶ | if ( ref $exception eq "Amazon::SQS::Exception" ) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 55 | 0 | $self->{_message} = $exception->getMessage(); | |||||||||||
| 56 | 0 | $self->{_statusCode} = $exception->getStatusCode(); | |||||||||||
| 57 | 0 | $self->{_errorCode} = $exception->getErrorCode(); | |||||||||||
| 58 | 0 | $self->{_errorType} = $exception->getErrorType(); | |||||||||||
| 59 | 0 | $self->{_requestId} = $exception->getRequestId(); | |||||||||||
| 60 | 0 | $self->{_xml} = $exception->getXML(); | |||||||||||
| 61 | 0 | $self->{_httpError} = $exception->getHTTPError(); | |||||||||||
| 62 | } | ||||||||||||
| 63 | } | ||||||||||||
| 64 | else { | ||||||||||||
| 65 | 0 | ▶ | $self->{_message} = $errorInfo->{Message} // q{}; | ||||||||||
|
Condition0%0/2
$errorInfo->{"Message"} // ""
MC/DC0%0/1
$errorInfo->{"Message"} // ""
$errorInfo->{"Message"}
Truth table0%0/2
A
A= $errorInfo->{"Message"}
| |||||||||||||
| 66 | 0 | ▶ | $self->{_statusCode} = $errorInfo->{StatusCode} // q{}; | ||||||||||
|
Condition0%0/2
$errorInfo->{"StatusCode"} // ""
MC/DC0%0/1
$errorInfo->{"StatusCode"} // ""
$errorInfo->{"StatusCode"}
Truth table0%0/2
A
A= $errorInfo->{"StatusCode"}
| |||||||||||||
| 67 | 0 | ▶ | $self->{_errorCode} = $errorInfo->{ErrorCode} // q{}; | ||||||||||
|
Condition0%0/2
$errorInfo->{"ErrorCode"} // ""
MC/DC0%0/1
$errorInfo->{"ErrorCode"} // ""
$errorInfo->{"ErrorCode"}
Truth table0%0/2
A
A= $errorInfo->{"ErrorCode"}
| |||||||||||||
| 68 | 0 | ▶ | $self->{_errorType} = $errorInfo->{ErrorType} // q{}; | ||||||||||
|
Condition0%0/2
$errorInfo->{"ErrorType"} // ""
MC/DC0%0/1
$errorInfo->{"ErrorType"} // ""
$errorInfo->{"ErrorType"}
Truth table0%0/2
A
A= $errorInfo->{"ErrorType"}
| |||||||||||||
| 69 | 0 | ▶ | $self->{_requestId} = $errorInfo->{RequestId} // q{}; | ||||||||||
|
Condition0%0/2
$errorInfo->{"RequestId"} // ""
MC/DC0%0/1
$errorInfo->{"RequestId"} // ""
$errorInfo->{"RequestId"}
Truth table0%0/2
A
A= $errorInfo->{"RequestId"}
| |||||||||||||
| 70 | 0 | ▶ | $self->{_xml} = $errorInfo->{XML} // q{}; | ||||||||||
|
Condition0%0/2
$errorInfo->{"XML"} // ""
MC/DC0%0/1
$errorInfo->{"XML"} // ""
$errorInfo->{"XML"}
Truth table0%0/2
A
A= $errorInfo->{"XML"}
| |||||||||||||
| 71 | 0 | ▶ | $self->{_httpError} = $errorInfo->{HTTPError} // q{}; | ||||||||||
|
Condition0%0/2
$errorInfo->{"HTTPError"} // ""
MC/DC0%0/1
$errorInfo->{"HTTPError"} // ""
$errorInfo->{"HTTPError"}
Truth table0%0/2
A
A= $errorInfo->{"HTTPError"}
| |||||||||||||
| 72 | } | ||||||||||||
| 73 | |||||||||||||
| 74 | 0 | return bless $self, $class; | |||||||||||
| 75 | } | ||||||||||||
| 76 | |||||||||||||
| 77 | # | ||||||||||||
| 78 | # Gets error type returned by the service if available. | ||||||||||||
| 79 | # | ||||||||||||
| 80 | 0 | ▶ | sub getErrorCode { | ||||||||||
|
Subroutine
getErrorCode: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||
| 81 | 0 | return shift->{_errorCode}; | |||||||||||
| 82 | } | ||||||||||||
| 83 | |||||||||||||
| 84 | # | ||||||||||||
| 85 | # Gets error type returned by the service. | ||||||||||||
| 86 | # | ||||||||||||
| 87 | # Possible types: Sender, Receiver or Unknown | ||||||||||||
| 88 | # | ||||||||||||
| 89 | 0 | ▶ | sub getErrorType { | ||||||||||
|
Subroutine
getErrorType: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||
| 90 | 0 | return shift->{_errorType}; | |||||||||||
| 91 | } | ||||||||||||
| 92 | |||||||||||||
| 93 | # | ||||||||||||
| 94 | # Gets error message | ||||||||||||
| 95 | # | ||||||||||||
| 96 | 0 | ▶ | sub getMessage { | ||||||||||
|
Subroutine
getMessage: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||
| 97 | 0 | return shift->{_message}; | |||||||||||
| 98 | } | ||||||||||||
| 99 | |||||||||||||
| 100 | # | ||||||||||||
| 101 | # Gets status code returned by the service if available. If status | ||||||||||||
| 102 | # code is set to -1, it means that status code was unavailable at the | ||||||||||||
| 103 | # time exception was thrown | ||||||||||||
| 104 | # | ||||||||||||
| 105 | 0 | ▶ | sub getStatusCode { | ||||||||||
|
Subroutine
getStatusCode: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||
| 106 | 0 | return shift->{_statusCode}; | |||||||||||
| 107 | } | ||||||||||||
| 108 | |||||||||||||
| 109 | # | ||||||||||||
| 110 | # Gets XML returned by the service if available. | ||||||||||||
| 111 | # | ||||||||||||
| 112 | 0 | ▶ | sub getXML { | ||||||||||
|
Subroutine
getXML: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||
| 113 | 0 | return shift->{_xml}; | |||||||||||
| 114 | } | ||||||||||||
| 115 | |||||||||||||
| 116 | # | ||||||||||||
| 117 | # Gets Request ID returned by the service if available. | ||||||||||||
| 118 | # | ||||||||||||
| 119 | 0 | ▶ | sub getRequestId { | ||||||||||
|
Subroutine
getRequestId: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||
| 120 | 0 | return shift->{_requestId}; | |||||||||||
| 121 | } | ||||||||||||
| 122 | |||||||||||||
| 123 | # | ||||||||||||
| 124 | # Gets the HTTP error response | ||||||||||||
| 125 | # | ||||||||||||
| 126 | 0 | ▶ | sub getHTTPError { | ||||||||||
|
Subroutine
getHTTPError: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||
| 127 | 0 | return shift->{_httpError}; | |||||||||||
| 128 | } | ||||||||||||
| 129 | |||||||||||||
| 130 | 3 | 1; | |||||||||||
| 131 | |||||||||||||
| 132 | __END__ | ||||||||||||