public class ServiceException
extends java.lang.Exception
StorageService
and related utilities.
This exception can hold useful additional information about errors that occur
when communicating with a service.Constructor and Description |
---|
ServiceException()
Create a service exception without any useful information.
|
ServiceException(java.lang.String message)
Create a service exception that includes a specific message.
|
ServiceException(java.lang.String message,
java.lang.String xmlMessage)
Create a service exception that includes the XML error document returned by service.
|
ServiceException(java.lang.String message,
java.lang.String xmlMessage,
java.lang.Throwable cause)
Create a service exception that includes a specific message, an optional XML error
document returned by service, and an optional underlying cause exception.
|
ServiceException(java.lang.String message,
java.lang.Throwable cause)
Create a service exception that includes a specific message and an
optional underlying cause exception.
|
ServiceException(java.lang.Throwable cause)
Create a service exception that includes an underlying cause exception.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getErrorCode() |
java.lang.String |
getErrorHostId() |
java.lang.String |
getErrorMessage() |
java.lang.String |
getErrorRequestId() |
java.lang.String |
getRequestHost() |
java.lang.String |
getRequestPath() |
java.lang.String |
getRequestVerb() |
int |
getResponseCode() |
java.lang.String |
getResponseDate() |
java.util.Map<java.lang.String,java.lang.String> |
getResponseHeaders() |
java.lang.String |
getResponseStatus() |
java.lang.String |
getXmlMessage() |
com.jamesmurty.utils.XMLBuilder |
getXmlMessageAsBuilder() |
boolean |
isParsedFromXmlMessage() |
void |
setErrorCode(java.lang.String code)
Set the exception's error code; for internal use only.
|
void |
setErrorHostId(java.lang.String hostId)
Set the exception's host ID; for internal use only.
|
void |
setErrorMessage(java.lang.String message)
Set the exception's error message; for internal use only.
|
void |
setErrorRequestId(java.lang.String requestId)
Set the exception's request ID; for internal use only.
|
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.
|
void |
setRequestHost(java.lang.String requestHost)
Set the exception's HTTP request hostname; for internal use only.
|
void |
setRequestPath(java.lang.String requestPath)
Set the exception's HTTP request path; for internal use only.
|
void |
setRequestVerb(java.lang.String requestVerb)
Set the exception's HTTP request verb; for internal use only.
|
void |
setResponseCode(int responseCode)
Set the exception's HTTP response code; for internal use only.
|
void |
setResponseDate(java.lang.String responseDate)
Set the exception's HTTP response date; for internal use only.
|
void |
setResponseHeaders(java.util.Map<java.lang.String,java.lang.String> responseHeaders)
Set the exception's HTTP response headers; for internal use only.
|
void |
setResponseStatus(java.lang.String responseStatus)
Set the exception's HTTP response status; for internal use only.
|
java.lang.String |
toString() |
public ServiceException(java.lang.String message, java.lang.String xmlMessage)
message
- xmlMessage
- public ServiceException(java.lang.String message, java.lang.String xmlMessage, java.lang.Throwable cause)
message
- xmlMessage
- cause
- public ServiceException()
public ServiceException(java.lang.String message, java.lang.Throwable cause)
message
- cause
- public ServiceException(java.lang.String message)
message
- public ServiceException(java.lang.Throwable cause)
cause
- public java.lang.String toString()
toString
in class java.lang.Throwable
public java.lang.String getErrorCode()
public void setErrorCode(java.lang.String code)
code
- public java.lang.String getErrorMessage()
public void setErrorMessage(java.lang.String message)
message
- public java.lang.String getErrorHostId()
public void setErrorHostId(java.lang.String hostId)
hostId
- public java.lang.String getErrorRequestId()
public void setErrorRequestId(java.lang.String requestId)
requestId
- public java.lang.String getXmlMessage()
public com.jamesmurty.utils.XMLBuilder getXmlMessageAsBuilder() throws java.io.IOException, javax.xml.parsers.ParserConfigurationException, org.xml.sax.SAXException
XMLBuilder
object that allows for simple XPath querying via XMLBuilder.xpathFind(String)
,
or null if no XML error document is available.java.io.IOException
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
public boolean isParsedFromXmlMessage()
public int getResponseCode()
public void setResponseCode(int responseCode)
responseCode
- public java.lang.String getResponseStatus()
public void setResponseStatus(java.lang.String responseStatus)
responseStatus
- public java.lang.String getResponseDate()
public void setResponseDate(java.lang.String responseDate)
responseDate
- public java.lang.String getRequestVerb()
public void setRequestVerb(java.lang.String requestVerb)
requestVerb
- public java.lang.String getRequestPath()
public void setRequestPath(java.lang.String requestPath)
requestPath
- public java.lang.String getRequestHost()
public void setRequestHost(java.lang.String requestHost)
requestHost
- public void setRequestAndHostIds(java.lang.String errorRequestId, java.lang.String errorHostId)
x-amz-request-id
and x-amz-id-2
respectively.errorRequestId
- errorHostId
- public java.util.Map<java.lang.String,java.lang.String> getResponseHeaders()
public void setResponseHeaders(java.util.Map<java.lang.String,java.lang.String> responseHeaders)
responseHeaders
-