Skip to main content

Module errors

Module errors 

Source
Expand description

The shared error naming policy.

The error model (which domains exist, which codes they carry, which module owns them) lives in the model as ErrorBinding. This module holds only the idiomatic naming rules every backend applies to those names, centralized so no target drifts into KEY_NOT_FOUNDError (raw SCREAMING_SNAKE with a naive Error suffix) while another emits keyNotFound.

Backends pick the suffix that matches their ecosystem (Error or Exception) and case-convert each code’s name through the helpers below.

Functions§

exception_type_name
Exception-branded type name for an error domain, for targets whose idiomatic errors are exceptions rather than *Error types. A trailing Error stem is replaced instead of stacked: KvError -> KvException; Failure -> FailureException; a bare Error -> Exception.
pascal
PascalCase form of a raw error code name, with no suffix. KEY_NOT_FOUND -> KeyNotFound. 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.