feagi_agent/sdk/
error.rs

1// Copyright 2025 Neuraville Inc.
2// SPDX-License-Identifier: Apache-2.0
3
4//! SDK error types
5
6use thiserror::Error;
7
8/// SDK-specific errors
9#[derive(Error, Debug)]
10pub enum SdkError {
11    /// Core agent error
12    #[error("Core agent error: {0}")]
13    Core(#[from] crate::core::SdkError),
14
15    /// Topology fetching failed
16    #[error("Failed to fetch topology: {0}")]
17    TopologyFetch(#[from] reqwest::Error),
18
19    /// Encoding failed
20    #[error("Encoding failed: {0}")]
21    EncodingFailed(String),
22
23    /// Decoding failed
24    #[error("Decoding failed: {0}")]
25    DecodingFailed(String),
26
27    /// Invalid configuration
28    #[error("Invalid configuration: {0}")]
29    InvalidConfiguration(String),
30
31    /// Topology not found
32    #[error("Topology not found for cortical ID: {0}")]
33    TopologyNotFound(String),
34
35    /// FEAGI data structure error
36    #[error("FEAGI data structure error: {0}")]
37    FeagiData(#[from] feagi_structures::FeagiDataError),
38
39    /// Device registration export/sync failed
40    #[error("Device registration sync failed: {0}")]
41    DeviceRegistrationSyncFailed(String),
42
43    /// Generic error
44    #[error("{0}")]
45    Other(#[from] anyhow::Error),
46}
47
48/// SDK result type
49pub type Result<T> = std::result::Result<T, SdkError>;