Module error

Source
Expand description

This module will define custom errors and error types for the library. The error module defines all error types that may arise when interacting with the OpenAI API.

The main error type exported here is OpenAIError, which enumerates various errors such as configuration issues, HTTP/network problems, or API-level responses indicating invalid requests, rate limits, and so on.

§Examples

use chat_gpt_lib_rs::OpenAIError;

fn example() -> Result<(), OpenAIError> {
    // Simulate an error scenario:
    Err(OpenAIError::ConfigError("No API key set".into()))
}

Enums§

OpenAIError
Represents any error that can occur while using the OpenAI Rust client library.