Skip to main content

classify_stream_error

Function classify_stream_error 

Source
pub fn classify_stream_error(body: &str) -> CompletionError
Expand description

Classifies an error envelope that arrives inside a 200 response stream.

The envelope carries body text alone, so only the body-text rules apply, in this order. Text that names a context limit is ContextOverflow. Text that names quota or billing is QuotaExhausted. Text that contains overloaded is Overloaded. Text that names a content policy term is Refused. Any other text is Transport, because the stream died in flight.

The message is the kind’s fixed phrase alone. body must already be bounded and control-escaped. The error keeps it as its detail.