Jesús Pérez 9095ea6d8e
Some checks failed
Nickel Type Check / Nickel Type Checking (push) Has been cancelled
Rust CI / Security Audit (push) Has been cancelled
Rust CI / Check + Test + Lint (nightly) (push) Has been cancelled
Rust CI / Check + Test + Lint (stable) (push) Has been cancelled
feat: add stratum-orchestrator with graph, state, NATS, and Nickel action nodes
New crates: stratum-orchestrator (Cedar authz, Vault secrets, Nu/agent executors,
  saga runner), stratum-graph (petgraph DAG + SurrealDB repo), stratum-state
  (SurrealDB tracker), platform-nats (NKey auth client), ncl-import-resolver.

  Updates: stratum-embeddings (SurrealDB store + persistent cache), stratum-llm
  circuit breaker. Adds Nickel action-nodes, schemas, config, Nushell scripts,
  docker-compose dev stack, and ADR-003.
2026-02-22 21:33:26 +00:00

80 lines
2.0 KiB
Rust

use thiserror::Error;
#[derive(Error, Debug)]
pub enum EmbeddingError {
#[error("Provider initialization failed: {0}")]
Initialization(String),
#[error("Provider not available: {0}")]
ProviderUnavailable(String),
#[error("API request failed: {0}")]
ApiError(String),
#[error("Invalid input: {0}")]
InvalidInput(String),
#[error("Dimension mismatch: expected {expected}, got {actual}")]
DimensionMismatch { expected: usize, actual: usize },
#[error("Batch size {size} exceeds maximum {max}")]
BatchSizeExceeded { size: usize, max: usize },
#[error("Cache error: {0}")]
CacheError(String),
#[error("Store error: {0}")]
StoreError(String),
#[error("Serialization error: {0}")]
SerializationError(String),
#[error("Rate limit exceeded: {0}")]
RateLimitExceeded(String),
#[error("Timeout: {0}")]
Timeout(String),
#[error("Configuration error: {0}")]
ConfigError(String),
#[error("IO error: {0}")]
IoError(String),
#[error("HTTP error: {0}")]
HttpError(String),
#[error(transparent)]
Other(#[from] Box<dyn std::error::Error + Send + Sync>),
}
impl From<std::io::Error> for EmbeddingError {
fn from(err: std::io::Error) -> Self {
Self::IoError(err.to_string())
}
}
impl From<serde_json::Error> for EmbeddingError {
fn from(err: serde_json::Error) -> Self {
Self::SerializationError(err.to_string())
}
}
#[cfg(feature = "reqwest")]
impl From<reqwest::Error> for EmbeddingError {
fn from(err: reqwest::Error) -> Self {
if err.is_timeout() {
Self::Timeout(err.to_string())
} else if err.is_status() {
Self::HttpError(format!(
"HTTP {}: {err}",
err.status().map_or_else(|| "<unknown>".to_string(), |s| s.to_string())
))
} else {
Self::ApiError(err.to_string())
}
}
}
pub type Result<T> = std::result::Result<T, EmbeddingError>;