Package com.bandwidth.exceptions
Class ApiException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- com.bandwidth.exceptions.ApiException
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
AccountsTnlookup400ErrorException
,ApiErrorException
,ErrorException
,ErrorWithRequestException
,ForbiddenRequestException
,MessagingException
,UnauthorizedRequestException
public class ApiException extends Exception
This is the base class for all exceptions that represent an error response from the server.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ApiException(String reason)
Initialization constructor.ApiException(String reason, HttpContext context)
Initialization constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HttpContext
getHttpContext()
The HTTP response body from the API request.int
getResponseCode()
The HTTP response code from the API request.-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
-
-
-
Constructor Detail
-
ApiException
public ApiException(String reason)
Initialization constructor.- Parameters:
reason
- The reason for throwing exception
-
ApiException
public ApiException(String reason, HttpContext context)
Initialization constructor.- Parameters:
reason
- The reason for throwing exceptioncontext
- The http context of the API exception
-
-
Method Detail
-
getResponseCode
public int getResponseCode()
The HTTP response code from the API request.- Returns:
- Returns the response code for ApiException
-
getHttpContext
public HttpContext getHttpContext()
The HTTP response body from the API request.- Returns:
- Returns the object of HttpContext for ApiException
-
-