Files
mixvideo-v2/cargos/uni-comfyui-sdk/src/error.rs
imeepos 08b981c31f feat: add uni-comfyui-sdk - Rust SDK for ComfyUI API
- Complete Rust SDK implementation based on OpenAPI specification
- All 23 endpoints implemented with type-safe interfaces
- Comprehensive error handling and async support
- Full documentation and examples included
- Client renamed to UniComfyUIClient for clear identification
2025-08-15 15:31:33 +08:00

41 lines
1.0 KiB
Rust

use thiserror::Error;
/// Result type alias for ComfyUI SDK operations
pub type Result<T> = std::result::Result<T, ComfyUIError>;
/// Error types for ComfyUI SDK operations
#[derive(Error, Debug)]
pub enum ComfyUIError {
/// HTTP request error
#[error("HTTP request failed: {0}")]
Http(#[from] reqwest::Error),
/// JSON serialization/deserialization error
#[error("JSON error: {0}")]
Json(#[from] serde_json::Error),
/// URL parsing error
#[error("URL parsing error: {0}")]
Url(#[from] url::ParseError),
/// API error response
#[error("API error: {status} - {message}")]
Api { status: u16, message: String },
/// Validation error
#[error("Validation error: {0}")]
Validation(String),
/// Server not found error
#[error("Server not found: {0}")]
ServerNotFound(String),
/// Workflow not found error
#[error("Workflow not found: {0}")]
WorkflowNotFound(String),
/// Generic error
#[error("Error: {0}")]
Generic(String),
}