pub enum Error {
Parsing(Box<ErrorDetails>),
Inversion(Box<ErrorDetails>),
Validation(Box<ErrorDetails>),
Registry {
details: Box<ErrorDetails>,
identifier: String,
kind: RegistryErrorKind,
},
ResourceLimitExceeded {
details: Box<ErrorDetails>,
limit_name: String,
limit_value: String,
actual_value: String,
},
Request {
details: Box<ErrorDetails>,
kind: RequestErrorKind,
},
}Expand description
Error types for the Lemma system with source location tracking
Variants§
Parsing(Box<ErrorDetails>)
Parse error with source location
Inversion(Box<ErrorDetails>)
Inversion error (valid Lemma, but unsupported by inversion) with source location
Validation(Box<ErrorDetails>)
Validation error (semantic/planning, including circular dependency) with source location
Registry
Registry resolution error with source location and structured error kind.
Produced when an @... reference cannot be resolved by the configured Registry
(e.g. the spec was not found, the request was unauthorized, or the network
is unreachable).
ResourceLimitExceeded
Resource limit exceeded
Request
Request error: invalid or unsatisfiable API request (e.g. spec not found, invalid parameters). Not a parse/planning failure; the request itself is invalid. Such errors occur before any evaluation and never during evaluation.
Implementations§
Source§impl Error
impl Error
Sourcepub fn parsing(
message: impl Into<String>,
source: Source,
suggestion: Option<impl Into<String>>,
) -> Self
pub fn parsing( message: impl Into<String>, source: Source, suggestion: Option<impl Into<String>>, ) -> Self
Create a parse error. Source is required: parsing errors always originate from source code.
Sourcepub fn parsing_with_context(
message: impl Into<String>,
source: Source,
suggestion: Option<impl Into<String>>,
spec_context: Option<Arc<LemmaSpec>>,
related_spec: Option<Arc<LemmaSpec>>,
) -> Self
pub fn parsing_with_context( message: impl Into<String>, source: Source, suggestion: Option<impl Into<String>>, spec_context: Option<Arc<LemmaSpec>>, related_spec: Option<Arc<LemmaSpec>>, ) -> Self
Parse error with optional spec context (for display).
Sourcepub fn parsing_with_suggestion(
message: impl Into<String>,
source: Source,
suggestion: impl Into<String>,
) -> Self
pub fn parsing_with_suggestion( message: impl Into<String>, source: Source, suggestion: impl Into<String>, ) -> Self
Create a parse error with suggestion. Source is required.
Sourcepub fn inversion(
message: impl Into<String>,
source: Option<Source>,
suggestion: Option<impl Into<String>>,
) -> Self
pub fn inversion( message: impl Into<String>, source: Option<Source>, suggestion: Option<impl Into<String>>, ) -> Self
Create an inversion error with source information.
Sourcepub fn inversion_with_context(
message: impl Into<String>,
source: Option<Source>,
suggestion: Option<impl Into<String>>,
spec_context: Option<Arc<LemmaSpec>>,
related_spec: Option<Arc<LemmaSpec>>,
) -> Self
pub fn inversion_with_context( message: impl Into<String>, source: Option<Source>, suggestion: Option<impl Into<String>>, spec_context: Option<Arc<LemmaSpec>>, related_spec: Option<Arc<LemmaSpec>>, ) -> Self
Inversion error with optional spec context (for display).
Sourcepub fn inversion_with_suggestion(
message: impl Into<String>,
source: Option<Source>,
suggestion: impl Into<String>,
spec_context: Option<Arc<LemmaSpec>>,
related_spec: Option<Arc<LemmaSpec>>,
) -> Self
pub fn inversion_with_suggestion( message: impl Into<String>, source: Option<Source>, suggestion: impl Into<String>, spec_context: Option<Arc<LemmaSpec>>, related_spec: Option<Arc<LemmaSpec>>, ) -> Self
Create an inversion error with suggestion
Sourcepub fn validation(
message: impl Into<String>,
source: Option<Source>,
suggestion: Option<impl Into<String>>,
) -> Self
pub fn validation( message: impl Into<String>, source: Option<Source>, suggestion: Option<impl Into<String>>, ) -> Self
Create a validation error with source information (semantic/planning, including circular dependency).
Sourcepub fn validation_with_context(
message: impl Into<String>,
source: Option<Source>,
suggestion: Option<impl Into<String>>,
spec_context: Option<Arc<LemmaSpec>>,
related_spec: Option<Arc<LemmaSpec>>,
) -> Self
pub fn validation_with_context( message: impl Into<String>, source: Option<Source>, suggestion: Option<impl Into<String>>, spec_context: Option<Arc<LemmaSpec>>, related_spec: Option<Arc<LemmaSpec>>, ) -> Self
Validation error with optional spec context and related spec (for display).
Sourcepub fn request(
message: impl Into<String>,
suggestion: Option<impl Into<String>>,
) -> Self
pub fn request( message: impl Into<String>, suggestion: Option<impl Into<String>>, ) -> Self
Create a request error (invalid API request, e.g. bad spec id). Request errors never have source locations — they are API-level.
Sourcepub fn request_not_found(
message: impl Into<String>,
suggestion: Option<impl Into<String>>,
) -> Self
pub fn request_not_found( message: impl Into<String>, suggestion: Option<impl Into<String>>, ) -> Self
Create a “spec not found” request error — map to HTTP 404.
Sourcepub fn rule_not_found(
rule_name: &str,
suggestion: Option<impl Into<String>>,
) -> Self
pub fn rule_not_found( rule_name: &str, suggestion: Option<impl Into<String>>, ) -> Self
Create a rule not found error
Sourcepub fn resource_limit_exceeded(
limit_name: impl Into<String>,
limit_value: impl Into<String>,
actual_value: impl Into<String>,
suggestion: impl Into<String>,
source: Option<Source>,
spec_context: Option<Arc<LemmaSpec>>,
related_spec: Option<Arc<LemmaSpec>>,
) -> Self
pub fn resource_limit_exceeded( limit_name: impl Into<String>, limit_value: impl Into<String>, actual_value: impl Into<String>, suggestion: impl Into<String>, source: Option<Source>, spec_context: Option<Arc<LemmaSpec>>, related_spec: Option<Arc<LemmaSpec>>, ) -> Self
Create a resource-limit-exceeded error with optional source location and spec context.
Sourcepub fn registry(
message: impl Into<String>,
source: Source,
identifier: impl Into<String>,
kind: RegistryErrorKind,
suggestion: Option<impl Into<String>>,
spec_context: Option<Arc<LemmaSpec>>,
related_spec: Option<Arc<LemmaSpec>>,
) -> Self
pub fn registry( message: impl Into<String>, source: Source, identifier: impl Into<String>, kind: RegistryErrorKind, suggestion: Option<impl Into<String>>, spec_context: Option<Arc<LemmaSpec>>, related_spec: Option<Arc<LemmaSpec>>, ) -> Self
Create a registry error. Source is required: registry errors point to @ref in source.
Sourcepub fn with_spec_context(self, spec: Arc<LemmaSpec>) -> Self
pub fn with_spec_context(self, spec: Arc<LemmaSpec>) -> Self
Attach spec context for display grouping. Returns a new Error with context set.
Attach a data-binding attribution. Returns a new Error carrying the data name.
Consumers (WASM JsError, LSP, HTTP) can read this via Error::related_data to attribute
the failure to a specific input field without parsing strings.
Source§impl Error
impl Error
Sourcepub fn kind(&self) -> ErrorKind
pub fn kind(&self) -> ErrorKind
Classify this error. Used by FFI/WASM consumers that need to branch on error category without depending on internal variant shapes.
Sourcepub fn source_location(&self) -> Option<&Source>
pub fn source_location(&self) -> Option<&Source>
Alias for Error::location. Preferred name when building the WASM/JS error payload.
Sourcepub fn source_text(&self, sources: &HashMap<String, String>) -> Option<String>
pub fn source_text(&self, sources: &HashMap<String, String>) -> Option<String>
Resolve source text from the sources map (for display). Source no longer stores text.
Sourcepub fn suggestion(&self) -> Option<&str>
pub fn suggestion(&self) -> Option<&str>
Get the suggestion if available.
Data name this error is attributed to (set at the data-binding call site).
Name of a related spec referenced by this error (e.g. a transitive dependency).
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()
Auto Trait Implementations§
impl Freeze for Error
impl RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnsafeUnpin for Error
impl UnwindSafe for Error
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> 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>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§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.