#[non_exhaustive]pub enum Error {
Configuration(String),
InvalidRequest(String),
Transport(TransportError),
#[non_exhaustive] Api {
status: StatusCode,
headers: Box<HeaderMap>,
body: String,
truncated: bool,
body_error: Option<TransportError>,
},
#[non_exhaustive] Body {
status: StatusCode,
headers: Box<HeaderMap>,
received: usize,
source: TransportError,
},
#[non_exhaustive] Decode {
status: StatusCode,
headers: Box<HeaderMap>,
body: String,
source: DecodeError,
},
#[non_exhaustive] ResponseTooLarge {
limit: usize,
status: StatusCode,
headers: Box<HeaderMap>,
},
UnexpectedPage {
requested: u32,
returned: u32,
},
PageLimit {
max_pages: u32,
},
Serialize(Arc<dyn Error + Send + Sync>),
}Expand description
Responses that fail keep their status and headers. Bodies may contain
operational data, so neither Display nor Debug prints them, nor any
response value quoted by a decoding error; read Error::body or
DecodeError::inner deliberately.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Configuration(String)
InvalidRequest(String)
Transport(TransportError)
#[non_exhaustive]Api
Fields
This variant is marked as non-exhaustive
status: StatusCodebody_error: Option<TransportError>Reading the body failed after the status and headers arrived;
body holds what was received.
#[non_exhaustive]Body
A successful status and headers arrived, but reading the body failed. For a mutation this is evidence that Kibana accepted the request, not proof of its outcome; reconcile by reading the resource back.
Fields
This variant is marked as non-exhaustive
status: StatusCodesource: TransportError#[non_exhaustive]Decode
Fields
This variant is marked as non-exhaustive
status: StatusCodesource: DecodeError#[non_exhaustive]ResponseTooLarge
Fields
This variant is marked as non-exhaustive
status: StatusCodeUnexpectedPage
A page stream received a different page than it requested.
PageLimit
A bounded page stream read its maximum number of pages while more remained.
Serialize(Arc<dyn Error + Send + Sync>)
Implementations§
Source§impl Error
impl Error
Sourcepub fn status(&self) -> Option<StatusCode>
pub fn status(&self) -> Option<StatusCode>
The HTTP status of a response that arrived, including successful responses whose body could not be read or decoded.
Sourcepub fn body(&self) -> Option<&str>
pub fn body(&self) -> Option<&str>
The retained body excerpt for API or decode errors, limited to 16 KiB. Interrupted reads and size-limit errors retain context but no body excerpt.
Sourcepub fn transport(&self) -> Option<&TransportError>
pub fn transport(&self) -> Option<&TransportError>
The connection, timeout or streaming failure behind this error, whether it happened before a response arrived or while reading its body.
Sourcepub fn message(&self) -> Option<String>
pub fn message(&self) -> Option<String>
The message field of a Kibana JSON error body, when present.
Sourcepub fn retry_after(&self) -> Option<Duration>
pub fn retry_after(&self) -> Option<Duration>
The Retry-After delay of an error response, when given in seconds.
HTTP-date values are not parsed.
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()