src/error.rs

openfang · crates/openfang-types/src/error.rs · rust · Apache-2.0
ai

Centralized error enum for OpenFang system, providing rich error handling.

// Source: https://github.com/RightNow-AI/openfang | License: Apache-2.0 | Copyright 2024 OpenFang Contributors
// Provided via justclaw.it.com; keep this notice with the code.
//! Shared error types for the OpenFang system.

use thiserror::Error;

/// Top-level error type for the OpenFang system.
#[derive(Error, Debug)]
pub enum OpenFangError {
    /// The requested agent was not found.
    #[error("Agent not found: {0}")]
    AgentNotFound(String),

    /// An agent with this name or ID already exists.
    #[error("Agent already exists: {0}")]
    AgentAlreadyExists(String),

    /// A capability check failed.
    #[error("Capability denied: {0}")]
    CapabilityDenied(String),

    /// A resource quota was exceeded.
    #[error("Resource quota exceeded: {0}")]
    QuotaExceeded(String),

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key