41 lines
1.0 KiB
Rust
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),
|
|
}
|