Enum backblaze_b2::B2Error
[−]
[src]
pub enum B2Error { HyperError(Error), IOError(Error), JsonError(Error), B2Error(StatusCode, B2ErrorMessage), ApiInconsistency(String), }
An error caused while using any of the B2 apis. Errors returned by the b2 api are stored exactly as received from backblaze and for ease of use several methods are provided on this type in order to check the kind of error.
The following methods are relevant for any backblaze api call:
is_service_unavilable
, is_too_many_requests
, should_back_off
.
The following methods are relevant for any backblaze api call beside authentication:
is_expired_authentication
, is_authorization_issue
,
should_obtain_new_authentication
.
Since these errors are so common, they are not mentioned directly in the documentation for the
api-call. Also take care with snapshot buckets, they might cause the error
is_snapshot_interaction_failure
, but the B2 documentation is inconsistent regarding when
this error can be returned.
Variants
HyperError(Error)
IOError(Error)
JsonError(Error)
B2Error(StatusCode, B2ErrorMessage)
When the b2 website returns an error, it is stored in this variant.
ApiInconsistency(String)
This type is only returned if the b2 website is not following the api spec.
Methods
impl B2Error
[src]
Load errors
Returns true if the B2 server returned any status code in the 5xx range. According to the
B2 specification, one should obtain new authentication in this case, so the method
should_obtain_new_authentication
always returns true if this method returns true.
fn is_too_many_requests(&self) -> bool
Returns true if we are making too many requests.
fn should_obtain_new_authentication(&self) -> bool
Returns true if any of the situtations described on the B2 documentation has occurred.
When this function returns true, you should obtain a new B2Authorization
.
fn should_back_off(&self) -> bool
Returns true if you should be using some sort of exponential back off for future requests.
impl B2Error
[src]
Authorization errors
fn is_credentials_issue(&self) -> bool
Returns true if the error is related to invalid credentials during authentication.
fn is_expired_authentication(&self) -> bool
Returns true if the error is caused by the authentication being expired. Consider using the
method should_obtain_new_authentication
instead.
Returns true if the error is caused by any issue related to the authorization token, including expired authentication tokens and invalid authorization tokens.
impl B2Error
[src]
File errors
fn is_invalid_file_name(&self) -> bool
Returns true if the error is caused by a file name which is not allowed on the b2 server.
fn is_file_not_found(&self) -> bool
Returns true if the error is related to a file that was not found.
Returns true if the error is caused by an attempt to hide a hidden file.
fn is_range_out_of_bounds(&self) -> bool
Returns true if the error is caused by a request to download an interval of a file that is out of bounds.
fn is_invalid_sha1(&self) -> bool
Returns true if the error is caused by the sha1 of the uploaded file not matching.
impl B2Error
[src]
Bucket errors
fn is_maximum_bucket_limit(&self) -> bool
Returns true if the error is caused by the account having reached the maximum bucket count.
fn is_duplicate_bucket_name(&self) -> bool
Returns true if the error is caused by an attempt to create a bucket with a name of a pre-existing bucket.
fn is_invalid_bucket_name(&self) -> bool
Returns true if the error is caused by an attempt to create a bucket with a name which is not allowed.
fn is_bucket_not_found(&self) -> bool
Returns true if the error is caused by requests to interact with buckets that do not exist.
impl B2Error
[src]
Various errors
fn is_conflict(&self) -> bool
Returns true if a request used a ifRevisionIs header and the test failed.
fn is_cap_exceeded(&self) -> bool
Returns true if the usage cap on backblaze b2 has been exceeded.
fn is_snapshot_interaction_failure(&self) -> bool
Returns true if the error is caused by interacting with snapshot buckets in ways not allowed.
fn is_prefix_issue(&self) -> bool
Returns true if the issue is regarding an invalid file prefix.
fn is_invalid_delimiter(&self) -> bool
Returns true if the issue is an invalid path delimiter.
Trait Implementations
impl Debug for B2Error
[src]
impl From<Error> for B2Error
[src]
impl From<Error> for B2Error
[src]
impl From<ParseError> for B2Error
[src]
fn from(err: ParseError) -> B2Error
Performs the conversion.