Type Alias BoxedError

Source
pub type BoxedError = Error<Box<dyn Error + Send + Sync>>;
Expand description

An Error without a single concrete type for the API error response, using a boxed trait object instead.

This is useful if a function needs to return some combination of different error types. They can be extracted later by using std::error::Error::downcast_ref or Error::downcast_ref_inner if desired.

See Error::boxed for how to convert a concretely-typed version of Error into this.

Aliased Type§

enum BoxedError {
    Api(Box<dyn Error + Sync + Send>),
    HttpClient(Box<dyn Error + Sync + Send>),
    Json(Error),
    UnexpectedResponse(String),
    BadRequest(String),
    Authentication(AuthError),
    RateLimited {
        reason: RateLimitReason,
        retry_after_seconds: u32,
    },
    AccessDenied(AccessError),
    ServerError(String),
    UnexpectedHttpError {
        code: u16,
        response: String,
    },
}

Variants§

§

Api(Box<dyn Error + Sync + Send>)

An error returned by the API. Its type depends on the endpoint being called.

§

HttpClient(Box<dyn Error + Sync + Send>)

Some error from the internals of the HTTP client.

§

Json(Error)

Something went wrong in the process of transforming your arguments into a JSON string.

§

UnexpectedResponse(String)

The Dropbox API response was unexpected or malformed in some way.

§

BadRequest(String)

The Dropbox API indicated that your request was malformed in some way.

§

Authentication(AuthError)

Errors occurred during authentication.

§

RateLimited

Your request was rejected due to rate-limiting. You can retry it later.

Fields

§reason: RateLimitReason

The server-given reason for the rate-limiting.

§retry_after_seconds: u32

You can retry this request after this many seconds.

§

AccessDenied(AccessError)

The user or team account doesn’t have access to the endpoint or feature.

§

ServerError(String)

The Dropbox API server had an internal error.

§

UnexpectedHttpError

The Dropbox API returned an unexpected HTTP response code.

Fields

§code: u16

HTTP status code returned.

§response: String

The response body.