Skip to main content

Module errors

Module errors 

Source
Expand description

Shared error-domain model and naming policy.

Every errors: domain declared anywhere in the API is flattened into a single, de-duplicated list (all) so all backends surface the same typed errors, and the idiomatic naming policy is centralized here so we never again emit drift like KEY_NOT_FOUNDError (raw SCREAMING_SNAKE with a naive Error suffix) in one language and keyNotFound in another.

Backends pick the brand/suffix that matches their ecosystem (ERROR_BRAND for Swift/Python/TS/C++/Ruby/Go, EXCEPTION_BRAND for Kotlin/.NET/Dart) and case-convert each code’s ResolvedError::raw_name through the helpers below.

Structs§

ResolvedError
A single error code, flattened across the whole API.

Constants§

BRAND_STEM
Canonical brand stem. Always WeaveFFI (uppercase FFI) — never the heck-derived Weaveffi that several generators used to emit.
ERROR_BRAND
Base error type for ecosystems that use the Error suffix (Swift, Python, TypeScript/Node, C++, Ruby, Go).
EXCEPTION_BRAND
Base exception type for ecosystems that use the Exception suffix (Kotlin/Android, .NET, Dart).

Functions§

all
All error codes declared anywhere in the API, in module-declaration order (depth-first), de-duplicated by raw_name (first occurrence wins). Returns an empty vec when the API declares no error domains.
has_domains
Whether the API declares any error domains at all.
pascal
PascalCase form of a raw error code name, with no suffix. KEY_NOT_FOUNDKeyNotFound. Use for languages whose error variants are nested types/cases (Kotlin sealed subclasses, etc.) rather than standalone *Error classes.
type_name
PascalCase + exactly one suffix, avoiding doubled or SCREAMING suffixes. ("KEY_NOT_FOUND", "Error")KeyNotFoundError; ("AlreadyError", "Error")AlreadyError.