pub struct ResponseValidationError { /* private fields */ }Expand description
A successful HTTP response whose body this SDK could not read.
Reach it through ErrorKind::ResponseValidation. The raw body is kept,
so a caller can recover data this version of the SDK does not model.
Implementations§
Source§impl ResponseValidationError
impl ResponseValidationError
Sourcepub fn field_path(&self) -> &str
pub fn field_path(&self) -> &str
The dotted path to the field that was missing or of the wrong type,
such as answers.spam.noul.
Empty when the body failed before any field could be named, which is what a syntax error or a document nested too deep gives.
Sourcepub fn status(&self) -> StatusCode
pub fn status(&self) -> StatusCode
The response status, which was a success status.
Sourcepub fn request_id(&self) -> Option<&str>
pub fn request_id(&self) -> Option<&str>
The server’s identifier for this request, from x-typesafe-request-id.
The header’s text exactly as it arrived; Display and Debug show it
escaped and cut at 128 characters instead.
Sourcepub fn endpoint(&self) -> Option<&str>
pub fn endpoint(&self) -> Option<&str>
The method and URL the request went to, without credentials, query or fragment.
Sourcepub fn message(&self) -> &str
pub fn message(&self) -> &str
The sentence for this failure, Invalid response data at '<path>'..
Sourcepub fn body_text(&self) -> Cow<'_, str>
pub fn body_text(&self) -> Cow<'_, str>
The response body as text, with anything that is not UTF-8 replaced by
U+FFFD.
Sourcepub fn body_json<'de, T>(&'de self) -> Result<T, DecodeError>where
T: Deserialize<'de>,
pub fn body_json<'de, T>(&'de self) -> Result<T, DecodeError>where
T: Deserialize<'de>,
The response body, decoded as JSON.
This is how a caller recovers data the SDK’s own response type dropped, including whatever made the decode fail.
§Errors
Returns a DecodeError when the body is not JSON, is nested deeper
than this crate’s limit, or does not fit T.
Sourcepub fn decode_error(&self) -> &DecodeError
pub fn decode_error(&self) -> &DecodeError
The decode failure underneath, which carries the position as well as the path.
Trait Implementations§
Source§impl Clone for ResponseValidationError
impl Clone for ResponseValidationError
Source§impl Debug for ResponseValidationError
impl Debug for ResponseValidationError
Source§impl Display for ResponseValidationError
impl Display for ResponseValidationError
Source§impl Error for ResponseValidationError
impl Error for ResponseValidationError
Source§fn source(&self) -> Option<&(dyn StdError + 'static)>
fn source(&self) -> Option<&(dyn StdError + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl From<ResponseValidationError> for Error
impl From<ResponseValidationError> for Error
Source§fn from(error: ResponseValidationError) -> Self
fn from(error: ResponseValidationError) -> Self
Auto Trait Implementations§
impl !Freeze for ResponseValidationError
impl RefUnwindSafe for ResponseValidationError
impl Send for ResponseValidationError
impl Sync for ResponseValidationError
impl Unpin for ResponseValidationError
impl UnsafeUnpin for ResponseValidationError
impl UnwindSafe for ResponseValidationError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString. Read more