pub enum Error {
Parsing(Box<ErrorDetails>),
Inversion(Box<ErrorDetails>),
Validation(Box<ErrorDetails>),
Registry {
details: Box<ErrorDetails>,
identifier: String,
kind: RegistryErrorKind,
},
MissingRepository {
details: Box<ErrorDetails>,
repository: String,
},
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).
MissingRepository
A referenced repository is not present in the context (not loaded / not fetched).
Produced during planning when a uses @repository ... reference names a repository
qualifier that has not been added to the workspace.
Fields
details: Box<ErrorDetails>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 missing_repository(
message: impl Into<String>,
source: Option<Source>,
repository: impl Into<String>,
suggestion: Option<impl Into<String>>,
spec_context: Option<Arc<LemmaSpec>>,
) -> Self
pub fn missing_repository( message: impl Into<String>, source: Option<Source>, repository: impl Into<String>, suggestion: Option<impl Into<String>>, spec_context: Option<Arc<LemmaSpec>>, ) -> Self
Repository referenced in source is not loaded in the context.
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 repository(&self) -> Option<&str>
pub fn repository(&self) -> Option<&str>
Repository identifier when the error is about a missing repository or a registry fetch target.
Populated for Error::MissingRepository and Error::Registry (identifier).
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<SourceType, String>,
) -> Option<String>
pub fn source_text( &self, sources: &HashMap<SourceType, 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).
Sourcepub fn spec_context_name(&self) -> Option<&str>
pub fn spec_context_name(&self) -> Option<&str>
Spec name when the error is attributed to a planning/eval context.
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()