HttpErrorMapper

org.llm4s.llmconnect.provider.HttpErrorMapper

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.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

def mapHttpError(statusCode: Int, body: String, provider: String): Result[Nothing]

Maps an HTTP error response to a typed org.llm4s.error.LLMError.

Maps an HTTP error response to a typed org.llm4s.error.LLMError.

Value parameters

body

the raw response body (may be JSON or plain text)

provider

short provider label used in error messages (e.g. "gemini")

statusCode

the HTTP status code (must be outside 2xx range)

Attributes

Returns

Left containing the appropriate LLMError subtype