Skip to main content

classify_error

Function classify_error 

Source
pub fn classify_error(err: &StoreError) -> OpResult
Expand description

Classifies a StoreError for the adaptive controller’s congestion signal.

Returns OpResult::Throttle for clearly transient / backpressure failures the controller should back off on (HTTP 429 / SlowDown / 503 / RESOURCE_EXHAUSTED, request timeouts, connection reset/closed, and the local-FS backpressure errno class — WouldBlock, EMFILE “too many open files”, and a full disk). Everything else — NotFound, Integrity, Parse, and ordinary I/O / backend errors — is OpResult::HardErr.

This is conservative: anything not clearly transient defaults to HardErr, so a real failure never masquerades as throttling. It inspects StoreError::Backend’s message + wrapped source string (the SDKs surface their status that way) and StoreError::Io’s std::io::ErrorKind.