Skip to main content

prepare_error_response

Function prepare_error_response 

Source
fn prepare_error_response(
    ctx: &mut Context,
    status: u16,
    code: &str,
    message: &str,
)
Expand description

Prepares the response common to every store-node error before it exits the node’s error port: status + JSON body + content-type, the same shape limit-count and the session plugins already use (e.g. authz_casdoor::store_error, limit_count.rs’s RATE_LIMIT_UNAVAILABLE branch).

Without this, a policy that wires error -> client – structurally the only alternative to leaving the port unwired, and the port model nudges every port toward being wired – would answer with whatever Context::new left in ctx.response (status_code == 0, mapped to 200 by the listener) instead of a real failure status. That is exactly the fail-open the design’s §7 rules out.