Skip to main content

encode_rpc_error

Function encode_rpc_error 

Source
pub fn encode_rpc_error<C>(
    codec: &C,
    headers: &HeaderMap,
    error: &CoolError,
) -> Response<Body>
where C: HttpTransport,
Expand description

Build an axum::Response carrying an RpcErrorBody for a CoolError raised inside the dispatcher (e.g. body decode failure, unknown op id). The HTTP status comes from CoolError::status_code; the body is codec-encoded via the request’s codec, content-type negotiated against RPC_BINDING_CAPABILITIES.