error-handling

Standardize error handling for the LiteLLM-RS gateway with structured variants and HTTP status mappings.

104|19|Updated Jul 15, 2025
One-click install
npx skills add https://github.com/majiayu000/litellm-rs --skill error-handling-majiayu000
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: error-handling
Source: https://github.com/majiayu000/litellm-rs/tree/main/.claude/skills/error-handling
Command: npx skills add https://github.com/majiayu000/litellm-rs --skill error-handling-majiayu000

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Unified, robust error handling for the LiteLLM-RS gateway and providers, enabling consistent error formats, clearer observability, and reliable retry/fallback behavior.

Core Features & Use Cases

  • Centralized ProviderError hierarchy with factory methods for uniform error creation.
  • HTTP status mapping, provider-specific error details, and context preservation across gateway and provider layers.
  • Use Case: handle 429 rate limits or 5xx gateway failures by classifying errors, applying backoff, and preserving rich diagnostic information for retries or fallbacks.

Quick Start

Start by adopting the ProviderError factory methods in your request handling, map HTTP errors with a map_http_error function, and integrate a retry strategy that respects error types and retry-after hints.

Frequently Asked Questions about error-handling

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I standardize error handling across multiple LLM providers in a Rust gateway?

Standardize multi-provider error handling in a Rust gateway by adopting a centralized ProviderError hierarchy with factory methods. This ensures uniform error creation, consistent formats, and clearer observability across different LLM provider responses.

How do I map HTTP status codes like 429 rate limits and 5xx failures to specific provider errors?

Map HTTP status codes to specific provider errors using a dedicated map_http_error function. This classifies 429 rate limits and 5xx gateway failures into structured error variants while preserving provider-specific error details and diagnostic context.

What is the best way to preserve diagnostic context when propagating errors across gateway and provider layers?

Preserve diagnostic context during error propagation by implementing structured error variants that carry provider-specific details. This context-rich error propagation maintains clear observability across both gateway and provider layers during request failures.

Does LiteLLM-RS support unified error formats for multi-provider routing scenarios?

LiteLLM-RS supports unified error formats for multi-provider routing through standardized error handling. It implements structured error variants, HTTP status mappings, and factory methods to ensure consistent error representation across multiple providers.