#[non_exhaustive]pub enum ZBError {
ExplicitError(String),
ApiError {
status: u16,
message: String,
},
JsonError(Error),
IntParseError(ParseIntError),
RequestError(Error),
IOError(Error),
}Expand description
Every error the SDK returns.
#[non_exhaustive]: a variant added later is not a breaking change, so a
match on it needs a _ arm.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
ExplicitError(String)
An error the SDK raised itself: an invalid argument or URL caught before a request, or a 2xx response body it could not read.
ApiError
The API answered and the answer is a failure: a non-2xx status, an HTML
error page, an error body on an HTTP 200, a bulk getfile error, or a
batch_validate account-level error. status is the HTTP status of that
response, so callers can tell a 403 from Cloudflare apart from a 400/404
from the API and a 429 from the Warmup rate limit. Both the validation
client and the Warmup client return it.
JsonError(Error)
IntParseError(ParseIntError)
RequestError(Error)
IOError(Error)
Implementations§
Source§impl ZBError
impl ZBError
pub fn explicit(string: &str) -> ZBError
pub fn api(status: u16, message: impl Into<String>) -> ZBError
Sourcepub fn status_code(&self) -> Option<u16>
pub fn status_code(&self) -> Option<u16>
The HTTP status of a failed API response: Some for every
ZBError::ApiError, including a failure the API reports with an HTTP
200. None when no failed response is involved: an argument or URL
rejected before a request, a transport error, or a 2xx body that could
not be parsed.
Trait Implementations§
Source§impl Error for ZBError
impl Error for ZBError
1.30.0 · 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()