Skip to main content

build_error_response

Function build_error_response 

Source
pub fn build_error_response(
    error: Error,
    protocol_label: &str,
    method: &str,
    uri: &str,
    status_tx: &UnboundedSender<String>,
) -> Result<Response<Full<Bytes>>, Infallible>
Expand description

Build error response for LLM failures.

The peer gets a category, never the error: error is classified by crate::utils::WireFailure and then only logged. Overload is transient and retryable, which 500 does not say, so it becomes 503 + Retry-After and a client backs off instead of recording a permanent server fault — that is the path a second concurrent request takes when --llm-max-concurrent is saturated and the queue is full or the wait timed out. Everything else is a 500.

Both branches carry a decision= tag, so an operator reading netget.log can tell a saturated backend from a broken one without parsing the error text (src/server/radius/ is the reference for this).