Error codes#
The code form#
Code form#
[a-z][a-z0-9_]*(\.[a-z][a-z0-9_]*)*
A code is the String in CallError’s code slot: dot-separated lower-snake-case segments, each starting with a letter.
The leftmost segment is the family, and later segments narrow within it. A code has at most four segments. A sent code has at least <family>.<leaf>.
Malformed code#
A CallError handed to the engine with a code outside the pattern enters working memory with code internal.invariant and every other slot as given.
No rule sees the malformed code. A one-segment code matches the pattern and enters as given.
(Spec: [LECC.1.5])
Families#
Standard families#
Family |
Meaning |
|---|---|
|
the request was rejected at validation or dispatch |
|
a bug on the side answering the call |
|
the system behind the service failed: it was unreachable, refused the request, throttled it or answered wrongly |
The sender of an adapter code names its leaf, in the code form.
Leaf codes#
request leaves#
Code |
Meaning |
|---|---|
|
the service is not offered |
|
the kwargs failed validation |
|
no outbound request could be constructed from the call |
|
the request exceeded a cap on the answering side, such as a result size or a query window |
A sender may add leaves under a standard family, in the code form.
(Spec: [LECC.3], [LECC.3.1.1], [LECC.3.1.2], [LECC.3.1.3], [LECC.3.1.4])
internal leaves#
Code |
Meaning |
|---|---|
|
an unhandled exception while servicing the call |
|
a violated invariant during the call’s lifecycle |
|
any other logic error on the answering side |
(Spec: [LECC.3.7.1], [LECC.3.7.2], [LECC.3.7.3])
Engine-emitted codes#
request.unsupported from the engine#
The engine emits request.unsupported itself when nothing is registered for the call’s target.
It has the wire shape and matching of any other code. A code’s value does not say which side emitted it; message may.
(Spec: [LECC.5.1], [LECC.5.2.2], [LECC.5.3])
The pattern-match contract#
Pattern-match contract#
An error pattern’s first segment is request, internal or adapter; any other is refused with DS_VALIDATE_ERROR_PATTERN_UNKNOWN_FAMILY. A pattern of more than four segments is refused with DS_VALIDATE_ERROR_PATTERN_TOO_DEEP.
error request: catches every leaf under the family, and error request.malformed: that one leaf. The matching is at Code matching.
Refused with DS_VALIDATE_ERROR_PATTERN_UNKNOWN_FAMILY
call svc.op level: r.level nocooldown
error auth:
log error "{r.id}"