Class B2Exception
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- com.backblaze.b2.client.exceptions.B2Exception
-
- All Implemented Interfaces:
java.io.Serializable
- Direct Known Subclasses:
B2BadRequestException,B2ForbiddenException,B2InternalErrorException,B2LocalException,B2NetworkBaseException,B2NotFoundException,B2RequestTimeoutException,B2ServiceUnavailableException,B2SignatureVerificationException,B2TooManyRequestsException,B2UnauthorizedException
public class B2Exception extends java.lang.ExceptionB2Exception is a checked exception class that's the base class for all B2-specific exceptions thrown by b2-sdk-java.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringDEFAULT_CODE
-
Constructor Summary
Constructors Constructor Description B2Exception(java.lang.String code, int status, java.lang.Integer retryAfterSecondsOrNull, java.lang.String message)B2Exception(java.lang.String code, int status, java.lang.Integer retryAfterSecondsOrNull, java.lang.String message, java.lang.Throwable cause)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static B2Exceptioncreate(java.lang.String code, int status, java.lang.Integer retryAfterSecondsOrNull, java.lang.String message)Returns a new B2Exception, trying to provide the appropriate subclass to characterize the it.java.lang.StringgetCode()java.lang.IntegergetRetryAfterSecondsOrNull()intgetStatus()java.lang.StringtoString()
-
-
-
Field Detail
-
DEFAULT_CODE
public static final java.lang.String DEFAULT_CODE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
B2Exception
public B2Exception(java.lang.String code, int status, java.lang.Integer retryAfterSecondsOrNull, java.lang.String message)
-
B2Exception
public B2Exception(java.lang.String code, int status, java.lang.Integer retryAfterSecondsOrNull, java.lang.String message, java.lang.Throwable cause)
-
-
Method Detail
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Throwable
-
getCode
public java.lang.String getCode()
-
getStatus
public int getStatus()
-
getRetryAfterSecondsOrNull
public java.lang.Integer getRetryAfterSecondsOrNull()
-
create
public static B2Exception create(java.lang.String code, int status, java.lang.Integer retryAfterSecondsOrNull, java.lang.String message)
Returns a new B2Exception, trying to provide the appropriate subclass to characterize the it.- Parameters:
code- the code from the error responsestatus- the http status from the response.retryAfterSecondsOrNull- the value of 'Retry-After' header if it's an integer number of seconds.message- the message in the error response.- Returns:
- a new B2Exception (maybe an instance of one of its subclasses)
-
-