libero/gen_error
Types
pub type GenError {
CannotReadDir(path: String, cause: simplifile.FileError)
CannotReadFile(path: String, cause: simplifile.FileError)
ParseFailed(path: String, cause: glance.Error)
UnresolvedTypeModule(module_path: String, type_name: String)
TypeNotFound(module_path: String, type_name: String)
DuplicateEndpoint(fn_name: String, modules: List(String))
TypeIdentityHashCollision(
hash: String,
signature_a: String,
signature_b: String,
)
DictKeyMustBePrimitive(
field_path: String,
key_type_repr: String,
)
WireTypeContainsTypeVar(field_path: String, var_name: String)
TypeResolutionFailed(path: String, message: String)
}
Constructors
-
CannotReadDir(path: String, cause: simplifile.FileError) -
CannotReadFile(path: String, cause: simplifile.FileError) -
ParseFailed(path: String, cause: glance.Error) -
UnresolvedTypeModule(module_path: String, type_name: String) -
TypeNotFound(module_path: String, type_name: String) -
DuplicateEndpoint(fn_name: String, modules: List(String)) -
TypeIdentityHashCollision( hash: String, signature_a: String, signature_b: String, )Two distinct canonical type signatures hashed to the same wire identity. Detected by
wire_identity.check_uniquenessat codegen time. Vanishingly rare in practice (truncated SHA-256 birthday resistance), but the cost of catching it is small. -
DictKeyMustBePrimitive(field_path: String, key_type_repr: String)A field declares
Dict(K, V)with K something other than Int, String, or Bool. Other key types have ambiguous JS-side identity or wire-encoding rules; the codegen rejects them upfront so behaviour is symmetric across BEAM and JS.field_pathlocates the offending field, e.g.admin/discounts.Discount field[2].value.keyfor a nested case.key_type_repris the FieldType’s canonical token string for readability in the error box. -
WireTypeContainsTypeVar(field_path: String, var_name: String)A field’s type still contains an unresolved type variable (generic parameter that survived to runtime). Wire transformer codegen needs the concrete type to emit encode/decode logic; a generic survives only if the user wrote a wire type with an uninstantiated generic parameter, which is a logic error.
-
TypeResolutionFailed(path: String, message: String)
Values
pub fn error_box(
title title: String,
path path: String,
body_lines body_lines: List(String),
hint hint: option.Option(String),
) -> String
Format a structured error as the boxed message libero prints to the
terminal. title is the one-line headline, path is the source file
or context the error refers to (rendered after ┌─), body_lines
are the explanation lines (each prefixed with │), and hint is an
optional remediation tip rendered below a separator.
Used by both typed GenError rendering and the TOML parser to keep
every error in the codebase consistent without duplicating the box
drawing.
pub fn print_error(err: GenError) -> Nil