Package com.dnanexus.exceptions
Class DXAPIException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- com.dnanexus.exceptions.DXAPIException
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
InternalErrorException,InvalidAuthenticationException,InvalidInputException,InvalidStateException,InvalidTypeException,OrgExpiredException,PermissionDeniedException,ResourceNotFoundException,ServiceUnavailableException,SpendingLimitExceededException
public class DXAPIException extends RuntimeException
Represents any response from the API server other than HTTP code 200 (OK).- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description DXAPIException(String message, int statusCode)Initializes a new exception with the specified message and HTTP status code.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static DXAPIExceptiongetInstance(String errorType, String errorMessage, int statusCode)Constructs aDXAPIExceptionof the appropriate subclass based on theerrorType.intgetStatusCode()Returns the HTTP status code associated with the error.StringtoString()-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
-
-
-
-
Constructor Detail
-
DXAPIException
public DXAPIException(String message, int statusCode)
Initializes a new exception with the specified message and HTTP status code.
-
-
Method Detail
-
getInstance
public static DXAPIException getInstance(String errorType, String errorMessage, int statusCode)
Constructs aDXAPIExceptionof the appropriate subclass based on theerrorType. If theerrorTypeis not one of the recognized subclasses, a genericDXAPIExceptionobject is returned.- Parameters:
errorType- String containing a DNAnexus error type, e.g.InvalidInputerrorMessage- String indicating the nature of the error.statusCode- HTTP status code of the response body.- Returns:
- Instance of
DXAPIExceptionor one of its subclasses.
-
getStatusCode
public int getStatusCode()
Returns the HTTP status code associated with the error.
-
-