Skip to main content

Module hosted_typed_error

Module hosted_typed_error 

Source
Expand description

Surfacing for the hosted server’s typed gRPC error vocabulary (AX H4).

The hosted weft server attaches machine-readable error details to failing gRPC responses as google.rpc.Status details (the standard grpc-status-details-bin trailer) — see weft crates/weft-server/src/server/typed_error.rs. The vocabulary is defined in api/proto/heddle/api/v1alpha1/errors.proto and both sides consume it via the heddle-api crate.

This module decodes the three conflict/pagination/stream details the CLI acts on — ConflictDetail, CursorFailure, StreamFailure — off a tonic::Status and projects them into:

  • the JSON/text error envelope (cli::commands::error_envelope): a stable kind, a recovery hint, and structured extra_json_fields an agent can branch on (the conflicting resource, the restart_cursor, whether a stream is resumable), and
  • the exit-code taxonomy (exit): a cursor/stream failure is a safe-retry (TempFail = 75, restart the pagination/stream); a conflict needs a changed input (a fresh op-id or a fetch+retry) so it stays a protocol-layer rejection (Protocol = 76).

Decoding is dependency-light: rather than pull in tonic-types, we decode the google.rpc.Status envelope with a local prost mirror ([RpcStatus]) and match the detail Any by its type.googleapis.com/heddle.api.v1alpha1.* type URL.

Enums§

HostedTypedError
A hosted typed error the CLI knows how to render + classify. Built from a tonic::Status via HostedTypedError::from_status; the first matching detail wins (a status carries at most one of these in practice).