org.jets3t.service
Class ServiceException
java.lang.Object
java.lang.Throwable
java.lang.Exception
org.jets3t.service.ServiceException
- All Implemented Interfaces:
- java.io.Serializable
- Direct Known Subclasses:
- S3ServiceException
public class ServiceException
- extends java.lang.Exception
Exception for use by StorageService
and related utilities.
This exception can hold useful additional information about errors that occur
when communicating with a service.
- See Also:
- Serialized Form
Methods inherited from class java.lang.Throwable |
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
ServiceException
public ServiceException(java.lang.String message,
java.lang.String xmlMessage)
- Constructor that includes the XML error document returned by service.
- Parameters:
message
- xmlMessage
-
ServiceException
public ServiceException()
ServiceException
public ServiceException(java.lang.String message,
java.lang.Throwable cause)
ServiceException
public ServiceException(java.lang.String message)
ServiceException
public ServiceException(java.lang.Throwable cause)
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Throwable
getErrorCode
public java.lang.String getErrorCode()
- Returns:
- The service-specific Error Code returned by the service, if a response is available.
For example "AccessDenied", "InternalError"
Null otherwise.
getErrorMessage
public java.lang.String getErrorMessage()
- Returns:
- The service-specific Error Message returned by the service, if a response is available.
For example: "Access Denied", "We encountered an internal error. Please try again."
getErrorHostId
public java.lang.String getErrorHostId()
- Returns:
- The Error Host ID returned by the service, if a response is available.
Null otherwise.
getErrorRequestId
public java.lang.String getErrorRequestId()
- Returns:
- The Error Request ID returned by the service, if a response is available.
Null otherwise.
getXmlMessage
public java.lang.String getXmlMessage()
- Returns:
- The XML Error message returned by the service, if a response is available.
Null otherwise.
isParsedFromXmlMessage
public boolean isParsedFromXmlMessage()
getResponseCode
public int getResponseCode()
- Returns:
- The HTTP Response Code returned by the service, if an HTTP response is available.
For example: 401, 404, 500
setResponseCode
public void setResponseCode(int responseCode)
getResponseStatus
public java.lang.String getResponseStatus()
- Returns:
- The HTTP Status message returned by the service, if an HTTP response is available.
For example: "Forbidden", "Not Found", "Internal Server Error"
setResponseStatus
public void setResponseStatus(java.lang.String responseStatus)
getResponseDate
public java.lang.String getResponseDate()
setResponseDate
public void setResponseDate(java.lang.String responseDate)
getRequestVerb
public java.lang.String getRequestVerb()
- Returns:
- The HTTP Verb used in the request, if available.
For example: "GET", "PUT", "DELETE"
setRequestVerb
public void setRequestVerb(java.lang.String requestVerb)
getRequestPath
public java.lang.String getRequestPath()
setRequestPath
public void setRequestPath(java.lang.String requestPath)
getRequestHost
public java.lang.String getRequestHost()
setRequestHost
public void setRequestHost(java.lang.String requestHost)
setRequestAndHostIds
public void setRequestAndHostIds(java.lang.String errorRequestId,
java.lang.String errorHostId)
- Allow the Request and Host Id fields to be populated in situations where
this information is not available from an XML response error document.
If there is no XML error response document, the RequestId and HostId will
generally be available as the HTTP response headers
x-amz-request-id
and x-amz-id-2
respectively.
- Parameters:
errorRequestId
- errorHostId
-
getResponseHeaders
public java.util.Map<java.lang.String,java.lang.String> getResponseHeaders()
setResponseHeaders
public void setResponseHeaders(java.util.Map<java.lang.String,java.lang.String> responseHeaders)