Class ServiceResponseException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- com.ibm.cloud.sdk.core.service.exception.ServiceResponseException
-
- All Implemented Interfaces:
java.io.Serializable
- Direct Known Subclasses:
BadRequestException,ConflictException,ForbiddenException,InternalServerErrorException,InvalidServiceResponseException,NotAcceptableException,NotFoundException,RequestTooLargeException,ServiceUnavailableException,TooManyRequestsException,UnauthorizedException,UnsupportedException
public class ServiceResponseException extends java.lang.RuntimeExceptionGeneric Service Response Exception.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ServiceResponseException(int statusCode, okhttp3.Response response)Instantiates a new Service Response Exception for a response that resulted in a bad status code.ServiceResponseException(int statusCode, okhttp3.Response response, java.lang.String message, java.lang.Throwable cause)Instantiates a new Service Response Exception when we have a specific exception to wrap.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Map<java.lang.String,java.lang.Object>getDebuggingInfo()Gets the response information other than the error message.HeadersgetHeaders()Gets the headers.java.lang.StringgetMessage()Gets the error message.java.lang.StringgetResponseBody()Gets the error response body as a string.intgetStatusCode()Gets the HTTP status code.
-
-
-
Constructor Detail
-
ServiceResponseException
public ServiceResponseException(int statusCode, okhttp3.Response response)Instantiates a new Service Response Exception for a response that resulted in a bad status code.- Parameters:
statusCode- the status coderesponse- the HTTP response
-
ServiceResponseException
public ServiceResponseException(int statusCode, okhttp3.Response response, java.lang.String message, java.lang.Throwable cause)Instantiates a new Service Response Exception when we have a specific exception to wrap.- Parameters:
statusCode- the status coderesponse- the HTTP responsemessage- a message to include in this exceptioncause- the specific exception to wrap inside this exception
-
-
Method Detail
-
getStatusCode
public int getStatusCode()
Gets the HTTP status code.- Returns:
- the http status code
-
getMessage
public java.lang.String getMessage()
Gets the error message.- Overrides:
getMessagein classjava.lang.Throwable- Returns:
- the error message
-
getHeaders
public Headers getHeaders()
Gets the headers.- Returns:
- the headers
-
getDebuggingInfo
public java.util.Map<java.lang.String,java.lang.Object> getDebuggingInfo()
Gets the response information other than the error message.- Returns:
- the response information other than the error message
-
getResponseBody
public java.lang.String getResponseBody()
Gets the error response body as a string.- Returns:
- the response body as a string
-
-