#[non_exhaustive]pub enum Error {
Show 15 variants
Config(String),
Header(InvalidHeaderValue),
Transport {
method: Method,
endpoint: String,
source: Error,
},
Api {
method: Method,
endpoint: String,
status: StatusCode,
body: String,
},
Storage {
context: String,
status: Option<StatusCode>,
body: Option<String>,
source: Option<Error>,
},
StreamNotFound {
name: String,
},
StreamIdNotFound {
id: i32,
},
NoBackup {
id: i32,
},
ImportTimeout {
timeout_secs: u64,
last_status: String,
},
ImportFailed {
id: i32,
message: String,
},
Protocol(String),
Io(Error),
Url(ParseError),
Json(Error),
IntegerConversion(TryFromIntError),
}Expand description
Error type returned by the MarpleDB SDK.
Transport means no usable HTTP response was received, Api means the
MarpleDB API returned a non-success status, and Storage covers direct
pre-signed storage uploads/downloads.
match error {
marple_db::Error::Api { status, body, .. } => {
eprintln!("API returned {status}: {body}");
}
error if error.status().is_some() => {
eprintln!("HTTP-like error: {:?}", error.status());
}
error => eprintln!("{error}"),
}Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Config(String)
The SDK was configured with invalid input.
Header(InvalidHeaderValue)
Building an HTTP header failed.
Transport
A request failed before receiving an API response.
Fields
Api
The MarpleDB API returned a non-success HTTP status.
Fields
status: StatusCodeResponse status code.
Storage
Direct storage upload or download failed.
Fields
status: Option<StatusCode>HTTP status code when the storage service responded with one.
StreamNotFound
A stream with the requested name was not found.
StreamIdNotFound
A stream with the requested id was not found.
NoBackup
The dataset has no original-file backup available for download.
ImportTimeout
Import polling reached its timeout before a terminal status.
ImportFailed
Import polling reached a failed terminal status.
Protocol(String)
The API returned a response that does not match the SDK protocol.
Io(Error)
Local filesystem I/O failed.
Url(ParseError)
URL parsing failed.
Json(Error)
JSON serialization or deserialization failed.
IntegerConversion(TryFromIntError)
Integer conversion failed.
Implementations§
Trait Implementations§
Source§impl Error for Error
impl Error for Error
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()