Skip to main content

Module errors

Module errors 

Source
Expand description

Error types for the Anthropic API client.

This module provides error handling for the library, including:

§Error Types

The API can return various error types:

  • ApiKeyNotSet - Missing API key
  • InvalidRequestError - Malformed request
  • AuthenticationError - Invalid API key
  • RateLimitError - Too many requests
  • OverloadedError - Server overloaded

§Example

use anthropic_tools::common::errors::{AnthropicToolError, Result};

fn validate_api_key(key: &str) -> Result<()> {
    if key.is_empty() {
        return Err(AnthropicToolError::ApiKeyNotSet);
    }
    Ok(())
}

Structs§

ErrorDetail
Error detail in API error response
ErrorResponse
Error response from Anthropic API

Enums§

AnthropicToolError
Anthropic API error types

Type Aliases§

Result