Skip to main content

classify_mistral_error

Function classify_mistral_error 

Source
pub fn classify_mistral_error(
    status: u16,
    message: impl Into<String>,
    retry_after: Option<f64>,
) -> Error
Expand description

Classify a non-success Mistral Chat Completions API HTTP response into a granular Error.

Mistral’s documented error body is {"object":"error","message":..., "type":...,"param":...,"code":...} (OpenAI-shaped but without a nested error wrapper). This maps by HTTP status only:

Unlike OpenAI, Mistral has no documented content-filter-specific error marker to key off of (no code: "content_filter" convention), so this never constructs Error::ServiceContentFilter – don’t invent one.