#[non_exhaustive]pub enum Error {
Show 13 variants
InvalidBaseUrl(String),
InvalidPath(String),
InvalidHeader(String),
InvalidTlsConfig(String),
InvalidTimeout(&'static str),
InvalidParameter(String),
Internal(&'static str),
BootstrapContention(&'static str),
Transport(&'static str),
Decode(String),
Api {
status: StatusCode,
errors: Vec<String>,
},
MissingField(&'static str),
MissingToken,
}Expand description
Errors returned by OpenBao client operations.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
InvalidBaseUrl(String)
Base URL parsing or validation failed.
InvalidPath(String)
The caller attempted to use a path that could change request meaning.
InvalidHeader(String)
An HTTP header value could not be represented safely.
InvalidTlsConfig(String)
TLS configuration is internally inconsistent.
InvalidTimeout(&'static str)
Timeout configuration is invalid.
InvalidParameter(String)
A request parameter is invalid.
Internal(&'static str)
A crate invariant was violated.
BootstrapContention(&'static str)
Bootstrap convergence detected that a concurrent writer changed the target during read-compare-write.
Transport(&'static str)
The request failed before an OpenBao response could be decoded.
Transport errors intentionally avoid retaining the underlying HTTP error because lower layers may attach request URLs to loggable error chains.
Decode(String)
A response body could not be decoded into the expected type.
Api
OpenBao returned an error status and optional API error list.
MissingField(&'static str)
A successful response did not contain the expected field.
MissingToken
An authenticated-only operation was attempted without a token.
Implementations§
Source§impl Error
impl Error
Sourcepub fn status(&self) -> Option<StatusCode>
pub fn status(&self) -> Option<StatusCode>
HTTP status when the failure was an OpenBao API error.
Sourcepub fn is_not_found(&self) -> bool
pub fn is_not_found(&self) -> bool
Returns true when OpenBao reported the requested path or value as absent.
Sourcepub fn is_forbidden(&self) -> bool
pub fn is_forbidden(&self) -> bool
Returns true when OpenBao rejected the caller’s token or policy.
Sourcepub fn is_bad_request(&self) -> bool
pub fn is_bad_request(&self) -> bool
Returns true when OpenBao reported a malformed or invalid request.
Sourcepub fn is_bootstrap_contention(&self) -> bool
pub fn is_bootstrap_contention(&self) -> bool
Returns true when bootstrap convergence detected a concurrent writer.
Sourcepub fn is_rate_limited(&self) -> bool
pub fn is_rate_limited(&self) -> bool
Returns true when OpenBao rate-limited the request.
Sourcepub fn is_sealed(&self) -> bool
pub fn is_sealed(&self) -> bool
Returns true when OpenBao is sealed or temporarily unavailable.
Sourcepub fn is_temporary(&self) -> bool
pub fn is_temporary(&self) -> bool
Returns true when retrying later may reasonably succeed.
This includes rate limiting, service unavailability, server errors, and
transport failures before an OpenBao response was decoded. It does not
treat sealed OpenBao as definitively recoverable for every application;
callers with strict startup behavior should check Self::is_sealed
separately.
Sourcepub fn is_permission_denied(&self) -> bool
pub fn is_permission_denied(&self) -> bool
Returns true when OpenBao reported an authentication or authorization failure.
This returns true for HTTP 403 responses and for API errors whose
message contains permission denied, which OpenBao can return outside
HTTP 403 in some policy-check paths. It is a superset of
Self::is_forbidden.
Sourcepub fn is_conflict(&self) -> bool
pub fn is_conflict(&self) -> bool
Returns true when a create operation lost an idempotent creation race.
OpenBao sometimes reports duplicate mounts and keys as HTTP 400 with
textual already exists/already in use messages rather than HTTP 409.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
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()