public class ServiceException extends 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(String message)
Create a service exception that includes a specific message.
|
ServiceException(String message,
String xmlMessage)
Create a service exception that includes the XML error document returned by service.
|
ServiceException(String message,
String xmlMessage,
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(String message,
Throwable cause)
Create a service exception that includes a specific message and an
optional underlying cause exception.
|
ServiceException(Throwable cause)
Create a service exception that includes an underlying cause exception.
|
| Modifier and Type | Method and Description |
|---|---|
String |
getErrorCode() |
String |
getErrorHostId() |
String |
getErrorMessage() |
String |
getErrorRequestId() |
String |
getRequestHost() |
String |
getRequestPath() |
String |
getRequestVerb() |
int |
getResponseCode() |
String |
getResponseDate() |
Map<String,String> |
getResponseHeaders() |
String |
getResponseStatus() |
String |
getXmlMessage() |
com.jamesmurty.utils.XMLBuilder |
getXmlMessageAsBuilder() |
boolean |
isParsedFromXmlMessage() |
void |
setErrorCode(String code)
Set the exception's error code; for internal use only.
|
void |
setErrorHostId(String hostId)
Set the exception's host ID; for internal use only.
|
void |
setErrorMessage(String message)
Set the exception's error message; for internal use only.
|
void |
setErrorRequestId(String requestId)
Set the exception's request ID; for internal use only.
|
void |
setRequestAndHostIds(String errorRequestId,
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(String requestHost)
Set the exception's HTTP request hostname; for internal use only.
|
void |
setRequestPath(String requestPath)
Set the exception's HTTP request path; for internal use only.
|
void |
setRequestVerb(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(String responseDate)
Set the exception's HTTP response date; for internal use only.
|
void |
setResponseHeaders(Map<String,String> responseHeaders)
Set the exception's HTTP response headers; for internal use only.
|
void |
setResponseStatus(String responseStatus)
Set the exception's HTTP response status; for internal use only.
|
String |
toString() |
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTracepublic ServiceException(String message, String xmlMessage)
message - xmlMessage - public ServiceException(String message, String xmlMessage, Throwable cause)
message - xmlMessage - cause - public ServiceException()
public ServiceException(String message, Throwable cause)
message - cause - public ServiceException(String message)
message - public ServiceException(Throwable cause)
cause - public String getErrorCode()
public void setErrorCode(String code)
code - public String getErrorMessage()
public void setErrorMessage(String message)
message - public String getErrorHostId()
public void setErrorHostId(String hostId)
hostId - public String getErrorRequestId()
public void setErrorRequestId(String requestId)
requestId - public String getXmlMessage()
public com.jamesmurty.utils.XMLBuilder getXmlMessageAsBuilder()
throws IOException,
ParserConfigurationException,
SAXException
XMLBuilder
object that allows for simple XPath querying via XMLBuilder.xpathFind(String),
or null if no XML error document is available.IOExceptionParserConfigurationExceptionSAXExceptionpublic boolean isParsedFromXmlMessage()
public int getResponseCode()
public void setResponseCode(int responseCode)
responseCode - public String getResponseStatus()
public void setResponseStatus(String responseStatus)
responseStatus - public String getResponseDate()
public void setResponseDate(String responseDate)
responseDate - public String getRequestVerb()
public void setRequestVerb(String requestVerb)
requestVerb - public String getRequestPath()
public void setRequestPath(String requestPath)
requestPath - public String getRequestHost()
public void setRequestHost(String requestHost)
requestHost - public void setRequestAndHostIds(String errorRequestId, String errorHostId)
x-amz-request-id and x-amz-id-2 respectively.errorRequestId - errorHostId - public Map<String,String> getResponseHeaders()