fix: cargo check --lib error
This commit is contained in:
parent
13e7d640e3
commit
60221bd457
|
|
@ -8,7 +8,7 @@ use tracing::{error, warn, info, debug};
|
||||||
use serde::{Serialize, Deserialize};
|
use serde::{Serialize, Deserialize};
|
||||||
|
|
||||||
/// 统一错误类型
|
/// 统一错误类型
|
||||||
#[derive(Debug, thiserror::Error)]
|
#[derive(Debug, Clone, thiserror::Error)]
|
||||||
pub enum ComfyUIError {
|
pub enum ComfyUIError {
|
||||||
/// 连接错误
|
/// 连接错误
|
||||||
#[error("连接错误: {message}")]
|
#[error("连接错误: {message}")]
|
||||||
|
|
@ -60,7 +60,13 @@ pub enum ComfyUIError {
|
||||||
|
|
||||||
/// SDK 错误
|
/// SDK 错误
|
||||||
#[error("SDK 错误: {0}")]
|
#[error("SDK 错误: {0}")]
|
||||||
Sdk(#[from] comfyui_sdk::error::ComfyUIError),
|
Sdk(String),
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<comfyui_sdk::error::ComfyUIError> for ComfyUIError {
|
||||||
|
fn from(error: comfyui_sdk::error::ComfyUIError) -> Self {
|
||||||
|
ComfyUIError::Sdk(error.to_string())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ComfyUIError {
|
impl ComfyUIError {
|
||||||
|
|
@ -72,12 +78,10 @@ impl ComfyUIError {
|
||||||
ComfyUIError::Timeout { .. } => true,
|
ComfyUIError::Timeout { .. } => true,
|
||||||
ComfyUIError::ResourceExhausted { .. } => true,
|
ComfyUIError::ResourceExhausted { .. } => true,
|
||||||
ComfyUIError::Sdk(sdk_error) => {
|
ComfyUIError::Sdk(sdk_error) => {
|
||||||
// 根据 SDK 错误类型判断是否可重试
|
// 检查 SDK 错误字符串是否包含可重试的错误类型
|
||||||
matches!(sdk_error,
|
sdk_error.contains("Http") ||
|
||||||
comfyui_sdk::error::ComfyUIError::Http(_) |
|
sdk_error.contains("Timeout") ||
|
||||||
comfyui_sdk::error::ComfyUIError::Timeout(_) |
|
sdk_error.contains("Connection")
|
||||||
comfyui_sdk::error::ComfyUIError::Connection(_)
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
_ => false,
|
_ => false,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ impl ServiceManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 初始化数据库
|
// 初始化数据库
|
||||||
self.repository.initialize().await?;
|
self.repository.initialize()?;
|
||||||
|
|
||||||
// 获取配置
|
// 获取配置
|
||||||
let config = self.config_manager.get_comfyui_config().await;
|
let config = self.config_manager.get_comfyui_config().await;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue