Skip to main content

Module codes

Module codes 

Source
Expand description

The failure vocabulary an action may report, as a closed enum.

§Why this is an enum and not a string

A failure leaves an action as a code, and the platform translates that code into a canonical code, a canonical category, and — the part no action author can be trusted to declare — an effect on stored data. A failed read changed nothing; a failed write may have landed, and that single bit decides whether the platform may retry the call on its own.

The translation table stays on the platform side. What lives here is the vocabulary the table is keyed by, so that a code with no translation is a compile error as you type rather than something to find out later, and so that there is one list to read.

§A code you do not find here

Code::Custom exists so an action can say “this invoice is already paid” without waiting for a platform release. A custom code is carried through to the model verbatim beside a generic canonical translation, which the platform treats as effect unknown — the safe reading, since nothing establishes what a code it has never seen did. Reach for a canonical variant where one fits.

Enums§

Category
The coarse class a failure belongs to, as the action reports it.
Code
A code the platform can translate, or one this action defines for itself.

Constants§

CANONICAL
Every code the platform’s translation table is keyed by, in table order.
UNSPECIFIED
What a custom code degrades to when it is not a shape the wire accepts.