#[non_exhaustive]pub enum WorkshopError {
Catalog(CatalogError),
Unknown {
kind: &'static str,
spelling: String,
locale: Locale,
span: Option<Span>,
},
UnknownWithCandidates {
kind: &'static str,
spelling: String,
locale: Locale,
candidates: Vec<String>,
span: Option<Span>,
},
MissingMapping {
kind: &'static str,
id: String,
locale: Locale,
},
Malformed {
message: String,
span: Option<Span>,
},
Unsupported {
message: String,
span: Option<Span>,
},
}Expand description
A structured Workshop-language error.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Catalog(CatalogError)
Catalog data is malformed or fails validation.
Unknown
A localized spelling is unknown or ambiguous.
UnknownWithCandidates
A localized spelling is unknown or ambiguous, and the rejecting site attached its nearest accepted spellings.
This is a separate variant from WorkshopError::Unknown so the
candidate list does not change that variant’s shape; consumers
matching Unknown should also match this variant to handle every
unknown-spelling diagnostic. The rendered message names the
candidates, so they reach consumers that only see the message text.
Fields
MissingMapping
A canonical builtin has no spelling mapped for the target locale.
Missing target-locale mappings fail explicitly (never a guess, never a
silent passthrough of another locale’s spelling); fallback is opt-in
(crate::emitter::EmitOptions, crate::convert::ConvertOptions).
Malformed
The input is syntactically malformed.
Unsupported
A construct is recognized but outside the supported surface.
Implementations§
Source§impl WorkshopError
impl WorkshopError
Sourcepub fn unknown(
kind: &'static str,
spelling: impl Into<String>,
locale: Locale,
span: Option<Span>,
) -> Self
pub fn unknown( kind: &'static str, spelling: impl Into<String>, locale: Locale, span: Option<Span>, ) -> Self
An Unknown spelling error.
Sourcepub fn with_candidates(self, candidates: Vec<String>) -> Self
pub fn with_candidates(self, candidates: Vec<String>) -> Self
Attach the nearest accepted spellings to an Unknown diagnostic,
producing WorkshopError::UnknownWithCandidates. Calling this on
a candidate-carrying error replaces the list; other variants are
returned unchanged.
Sourcepub fn candidates(&self) -> &[String]
pub fn candidates(&self) -> &[String]
The nearest accepted spellings for an Unknown spelling, when the
rejecting site computed them. Other variants report an empty slice.