error
Package error provides shared error tag definitions for durable programs.
load("error", ...)
codes
codes exposes gRPC status codes as error tags for use in ! functions.
Use these to catch and match specific gRPC errors returned by service calls,
e.g. my_fn() catch err: assert.eq(err.tag, codes.NOT_FOUND).
For reading integer status codes from grpc.with_call results, use load("grpc", "codes") instead.
Each tag is callable and produces an error value that ! functions can return:
codes.NOT_FOUND(message = "resource not found")
codes.NOT_FOUND(message = "resource not found", cause = upstream_err)
codes.NOT_FOUND(message = "resource not found", extra = some_value)
The optional extra parameter attaches additional detail to the gRPC status response.
The value is interpreted as follows:
- Proto message — attached directly as a gRPC status detail.
- List of proto messages — each message attached as a separate gRPC status detail.
- String — wrapped in a google.rpc.DebugInfo message with the string in the detail field.
- List of strings — wrapped in a single google.rpc.DebugInfo message with the strings in the stack_entries field.
- Any other value (including None) — silently ignored; no detail is attached.
load("error", "codes")
Constants
CANCELLED=CANCELLED- ConstantUNKNOWN=UNKNOWN- ConstantINVALID_ARGUMENT=INVALID_ARGUMENT- ConstantDEADLINE_EXCEEDED=DEADLINE_EXCEEDED- ConstantNOT_FOUND=NOT_FOUND- ConstantALREADY_EXISTS=ALREADY_EXISTS- ConstantPERMISSION_DENIED=PERMISSION_DENIED- ConstantRESOURCE_EXHAUSTED=RESOURCE_EXHAUSTED- ConstantFAILED_PRECONDITION=FAILED_PRECONDITION- ConstantABORTED=ABORTED- ConstantOUT_OF_RANGE=OUT_OF_RANGE- ConstantUNIMPLEMENTED=UNIMPLEMENTED- ConstantINTERNAL=INTERNAL- ConstantUNAVAILABLE=UNAVAILABLE- ConstantDATA_LOSS=DATA_LOSS- ConstantUNAUTHENTICATED=UNAUTHENTICATED- Constant
runtime
load("error", "runtime")
Constants
PARSE_ERROR=PARSE_ERROR- ConstantIO_ERROR=IO_ERROR- ConstantENCODING_ERROR=ENCODING_ERROR- Constant