pub struct CompileError {
pub code: ErrorCode,
pub stage: Stage,
pub json_pointer_path: Option<String>,
pub keyword: Option<String>,
pub observed: Option<String>,
pub limit: Option<(LimitKind, usize, usize)>,
pub recoverable: bool,
pub message: &'static str,
}Expand description
A structured compile-time error. Send + Sync; the machine contract is the fields, not message.
Fields§
§code: ErrorCodeStable machine code.
stage: StageThe stage the error arose in.
json_pointer_path: Option<String>JSON Pointer (RFC 6901) to the offending node, when known.
keyword: Option<String>The offending keyword, when applicable.
observed: Option<String>The observed value/shape, when useful for diagnostics.
limit: Option<(LimitKind, usize, usize)>(kind, observed, cap) when a resource limit produced the error.
recoverable: boolWhether a fallback path exists for this error.
message: &'static strAdvisory human-readable text. NEVER the machine contract.
Implementations§
Source§impl CompileError
impl CompileError
Sourcepub fn new(code: ErrorCode, stage: Stage, message: &'static str) -> Self
pub fn new(code: ErrorCode, stage: Stage, message: &'static str) -> Self
Creates an error with the given code, stage, and advisory message; all optional fields empty.
Sourcepub fn with_pointer(self, path: impl Into<String>) -> Self
pub fn with_pointer(self, path: impl Into<String>) -> Self
Attaches a JSON Pointer path.
Sourcepub fn with_keyword(self, keyword: impl Into<String>) -> Self
pub fn with_keyword(self, keyword: impl Into<String>) -> Self
Attaches the offending keyword.
Sourcepub fn with_observed(self, observed: impl Into<String>) -> Self
pub fn with_observed(self, observed: impl Into<String>) -> Self
Attaches an observed-value description.
Trait Implementations§
Source§impl Clone for CompileError
impl Clone for CompileError
Source§fn clone(&self) -> CompileError
fn clone(&self) -> CompileError
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CompileError
impl Debug for CompileError
Source§impl Display for CompileError
impl Display for CompileError
impl Eq for CompileError
Source§impl Error for CompileError
impl Error for CompileError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Source§impl From<CompileError> for SessionError
impl From<CompileError> for SessionError
Source§fn from(e: CompileError) -> Self
fn from(e: CompileError) -> Self
Converts to this type from the input type.
Source§impl From<CompileError> for StructuredMatcherError
impl From<CompileError> for StructuredMatcherError
Source§fn from(error: CompileError) -> Self
fn from(error: CompileError) -> Self
Converts to this type from the input type.
Source§impl PartialEq for CompileError
impl PartialEq for CompileError
impl StructuralPartialEq for CompileError
Auto Trait Implementations§
impl Freeze for CompileError
impl RefUnwindSafe for CompileError
impl Send for CompileError
impl Sync for CompileError
impl Unpin for CompileError
impl UnsafeUnpin for CompileError
impl UnwindSafe for CompileError
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
Mutably borrows from an owned value. Read more