#[non_exhaustive]pub struct ParseError(/* private fields */);Expand description
JSON deserialize / parse error reported by the underlying JSON parser.
The inner third-party error type is private; callers diagnose the
failure via the accessor methods on this wrapper, all of which return
primitive types or the workspace-local ParseCategory enum. The
wrapper exists so that the ClientError::Parse variant payload is
insulated from a future JSON-parser swap (bd:JMAP-6r7c.26).
Construct via ClientError::from_parse (the common path) or
ParseError::from_serde_json (the low-level path that returns a
wrapper without classifying it into a ClientError variant).
Implementations§
Source§impl ParseError
impl ParseError
Sourcepub fn from_serde_json(e: Error) -> Self
pub fn from_serde_json(e: Error) -> Self
Wrap a serde_json::Error into a ParseError.
Most callers want ClientError::from_parse which wraps and
classifies in one step; this lower-level constructor is for
callers that need to hold a ParseError before deciding
whether to surface it as ClientError::Parse or in some
other variant.
Sourcepub fn line(&self) -> usize
pub fn line(&self) -> usize
One-based line number where parsing failed, or 0 if the parser
does not report a line number for this error category.
Sourcepub fn column(&self) -> usize
pub fn column(&self) -> usize
One-based column number where parsing failed, or 0 if the parser
does not report a column number for this error category.
Sourcepub fn classify(&self) -> ParseCategory
pub fn classify(&self) -> ParseCategory
Coarse-grained category of the failure.
See ParseCategory for the variant set and what each one means.
Trait Implementations§
Source§impl Debug for ParseError
impl Debug for ParseError
Source§impl Display for ParseError
impl Display for ParseError
Source§impl Error for ParseError
impl Error for ParseError
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()
Auto Trait Implementations§
impl !RefUnwindSafe for ParseError
impl !UnwindSafe for ParseError
impl Freeze for ParseError
impl Send for ParseError
impl Sync for ParseError
impl Unpin for ParseError
impl UnsafeUnpin for ParseError
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
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>
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.