pub enum StorageError {
Api {
status: StatusCode,
body: ApiErrorBody,
},
InvalidPath {
path: String,
reason: PathError,
},
InvalidBaseUrl,
MissingSignedToken(String),
SignFailed {
path: String,
message: String,
},
Url(ParseError),
Http(Error),
Json(Error),
InvalidHeader(InvalidHeaderValue),
}Expand description
Errors returned by StorageClient and Bucket.
Variants§
Api
The Storage API answered with a non-success HTTP status.
InvalidPath
A bucket id or object path is not valid.
InvalidBaseUrl
The project URL cannot carry path segments (for example mailto:).
MissingSignedToken(String)
The Storage API returned a signed URL without a ?token= query.
SignFailed
The Storage API did not sign an object, for example because it does not exist or the caller cannot read it.
Url(ParseError)
A URL could not be parsed or joined.
Http(Error)
The HTTP transport failed.
Json(Error)
A success response body is not the expected JSON.
InvalidHeader(InvalidHeaderValue)
A key, token, or option is not a valid HTTP header value.
Implementations§
Source§impl StorageError
impl StorageError
Sourcepub fn api_status(&self) -> Option<StatusCode>
pub fn api_status(&self) -> Option<StatusCode>
Status the Storage API reports for an StorageError::Api error, None for other
errors.
The object routes answer most errors with HTTP 400 and put the real status in the
body’s statusCode, for example "404" for a missing object and "403" when row level
security denies access. This returns the body status when it is a valid status code and
the HTTP status otherwise.
Sourcepub const fn code(&self) -> Option<&StorageErrorCode>
pub const fn code(&self) -> Option<&StorageErrorCode>
Machine-readable code of an StorageError::Api error body, None for other
errors and for bodies without a code.
For example, an upload without upsert to an existing path fails with
StorageErrorCode::KeyAlreadyExists or StorageErrorCode::ResourceAlreadyExists,
and a delete that row level security blocks fails with
StorageErrorCode::AccessDenied.
Trait Implementations§
Source§impl Debug for StorageError
impl Debug for StorageError
Source§impl Display for StorageError
impl Display for StorageError
Source§impl Error for StorageError
impl Error for StorageError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()