Skip to main content

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 - Constant
  • UNKNOWN = UNKNOWN - Constant
  • INVALID_ARGUMENT = INVALID_ARGUMENT - Constant
  • DEADLINE_EXCEEDED = DEADLINE_EXCEEDED - Constant
  • NOT_FOUND = NOT_FOUND - Constant
  • ALREADY_EXISTS = ALREADY_EXISTS - Constant
  • PERMISSION_DENIED = PERMISSION_DENIED - Constant
  • RESOURCE_EXHAUSTED = RESOURCE_EXHAUSTED - Constant
  • FAILED_PRECONDITION = FAILED_PRECONDITION - Constant
  • ABORTED = ABORTED - Constant
  • OUT_OF_RANGE = OUT_OF_RANGE - Constant
  • UNIMPLEMENTED = UNIMPLEMENTED - Constant
  • INTERNAL = INTERNAL - Constant
  • UNAVAILABLE = UNAVAILABLE - Constant
  • DATA_LOSS = DATA_LOSS - Constant
  • UNAUTHENTICATED = UNAUTHENTICATED - Constant

runtime

load("error", "runtime")

Constants

  • PARSE_ERROR = PARSE_ERROR - Constant
  • IO_ERROR = IO_ERROR - Constant
  • ENCODING_ERROR = ENCODING_ERROR - Constant