ReqLLM.Step.Error (ReqLLM v1.0.0)
View SourceReq step that integrates with Splode error handling.
This step converts HTTP error responses to structured ReqLLM.Error exceptions and handles common API error patterns. It processes both regular HTTP errors and API-specific error responses.
Usage
request
|> ReqLLM.Step.Error.attach()The step handles various HTTP status codes and converts them to appropriate ReqLLM.Error types:
- 400: Bad Request → API.Request error
- 401: Unauthorized → API.Request error with authentication context
- 403: Forbidden → API.Request error with authorization context
- 404: Not Found → API.Request error
- 429: Rate Limited → API.Request error with rate limit context
- 500+: Server Error → API.Request error with server context
Error Structure
All errors include:
status- HTTP status codereason- Human-readable error descriptionresponse_body- Raw API response (if available)request_body- Original request body (if available)cause- Underlying error cause (if available)
Summary
Functions
Attaches the Splode error handling step to a Req request struct.
Types
Functions
@spec attach(Req.Request.t()) :: Req.Request.t()
Attaches the Splode error handling step to a Req request struct.
Parameters
req- The Req request struct
Returns
- Updated Req request struct with the step attached