Skip to main content

LeituraError

Enum LeituraError 

Source
pub enum LeituraError {
    Leitura(LispError),
    DialetoEstrangeiro {
        dialeto: CaixaDialeto,
    },
    Dialeto(DialetoError),
}
Expand description

Why reading a manifest into a Caixa failed.

Split from ManifestError (which reports a parsed manifest that is semantically wrong) because the two answer different questions, and the distinction is the whole point of this type: ManifestError means “your caixa is wrong”, LeituraError::DialetoEstrangeiro means “this file is not a caixa”.

Variants§

§

Leitura(LispError)

The source is not readable as a (defcaixa …) package manifest — bad syntax, a wrong head symbol, an unknown or mistyped slot.

#[source], not #[error(transparent)]. Transparent delegates source() past the inner error to ITS source, which drops the LispError off the cause chain — and feira’s load_caixa_parse_error_preserves_underlying_lisp_error_on_chain pins that a caller can downcast_ref::<tatara_lisp::LispError>() through an anyhow context to read the typed payload. That pin caught this exact regression when the variant first landed transparent.

§

DialetoEstrangeiro

The source IS a well-formed (defcaixa …) form, but of a different declaration than this crate’s.

The variant that did not exist before, and whose absence is the defect. A (defcaixa :name "x" :ecosystem :go …) used to reach the derive’s parse_kwargs_strict and come back as an unknown-keyword rejection — byte-identical in shape to a typo in a real manifest. Measured over the org checkout on 2026-07-31, that shape is the MAJORITY of the corpus, so the confusing error was also the common one.

Carrying the dialect means a consumer can branch on “not mine” without re-parsing, and a census can count it. Every user-facing byte-string (canonical keyword, one-line description, consuming crate) is a projection of crate::dialeto::CaixaDialeto — the variant stores the typed dialect and the #[error] template calls [CaixaDialeto::palavra_canonica] / [CaixaDialeto::descricao] / [CaixaDialeto::consumidor] on it, so the three axes cannot silently diverge from the classification. Prior to this closure the variant carried each accessor’s return value as a stored &'static str snapshot alongside dialeto, and the sole constructor at Caixa::from_lisp filled all four fields — a caller could construct DialetoEstrangeiro { dialeto: Molde, palavra_canonica: "defcaixa", … } and every downstream consumer (Display, ad-hoc audit, future JSON serialization) would silently disagree with dialeto.palavra_canonica() == "defmolde". The typed enum owns the projections; the variant only carries the axis.

Fields

§dialeto: CaixaDialeto

Which declaration this actually is. Sole authoritative axis; every user-facing projection routes through crate::dialeto::CaixaDialeto’s typed accessors so the four axes cannot silently disagree.

§

Dialeto(DialetoError)

Not a manifest declaration at all.

Implementations§

Source§

impl LeituraError

Source

pub fn dialeto_estrangeiro(dialeto: CaixaDialeto) -> Self

Construct a LeituraError::DialetoEstrangeiro naming the foreign-dialect classification the Caixa::from_lisp gate refused a (defcaixa …) source as.

Substrate primitive every foreign-dialect emission on the Caixa::from_lisp classification-gate surface routes through, folding the pre-lift uniform three-line Self::DialetoEstrangeiro { dialeto } one-field struct-literal onto one substrate primitive matching the peer crate::dialeto::DialetoError::cabeca_errada (38d5159) single-slot inherent-ctor discipline on the sibling crate::dialeto::DialetoError envelope’s { encontrado: String } axis, and matching the peer LimitsError::unknown_byte_unit / LimitsError::unknown_duration_unit (limits_codec_unit_only_ctors! — 29fac09) / ManifestError::code_path_empty (94dabc8) / BehaviorError::empty_path (0e33b37) / UpgradeError::duplicate_from (7e52aec) / AplicacaoError::placement_cluster_duplicate (92b1c92) single-slot inherent-ctor discipline every sibling { <field>: <T> } error-envelope variant on caixa-core’s error surface now carries.

The one open-coded wire-up site — Caixa::from_lisp’s crate::dialeto::CaixaDialeto::is_molde_family branch after the crate::dialeto::classify_form classification — opened the uniform two-line Self::DialetoEstrangeiro { dialeto } block against the codec-scoped dialeto: CaixaDialeto binding. Routes through LeituraError::dialeto_estrangeiro(dialeto), byte-equal to the pre-lift struct-literal on the same Copy-bound crate::dialeto::CaixaDialeto fixture, so any future widening of the diagnostic shape (a stored source-file path alongside the classified dialect, an authoring-surface caret offset into the top-level form, a promotion of the plain dialeto: field into a richer projection carrying both the typed dialect and a Vec<Suggestion> neighborhood) lands at exactly one dispatch on the substrate primitive rather than re-inlining the struct-literal at every foreign-dialect emission on the classification gate.

Trait Implementations§

Source§

impl Debug for LeituraError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for LeituraError

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for LeituraError

Source§

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

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<DialetoError> for LeituraError

Source§

fn from(source: DialetoError) -> Self

Converts to this type from the input type.
Source§

impl From<LispError> for LeituraError

Source§

fn from(source: LispError) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.