Shared HTTP status-code to org.llm4s.error.LLMError mapping used by all HTTP-based LLM provider clients.
Centralises the duplicated pattern of converting non-2xx responses into typed Result errors. Provider-specific error details are extracted from the JSON response body when possible and truncated to a safe length.
A 429's Retry-After header (delta-seconds or an HTTP-date, name matched case-insensitively) becomes the error's retryAfter duration; an absent, unparseable or negative value leaves it unset, so the error's default backoff applies.
Value parameters
body
the raw response body (may be JSON or plain text)
headers
the response headers, as carried by org.llm4s.http.HttpResponse; pass them whenever the response is available
provider
short provider label used in error messages (e.g. "gemini")