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};
|
||||
|
||||
/// 统一错误类型
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
#[derive(Debug, Clone, thiserror::Error)]
|
||||
pub enum ComfyUIError {
|
||||
/// 连接错误
|
||||
#[error("连接错误: {message}")]
|
||||
|
|
@ -60,7 +60,13 @@ pub enum ComfyUIError {
|
|||
|
||||
/// SDK 错误
|
||||
#[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 {
|
||||
|
|
@ -72,12 +78,10 @@ impl ComfyUIError {
|
|||
ComfyUIError::Timeout { .. } => true,
|
||||
ComfyUIError::ResourceExhausted { .. } => true,
|
||||
ComfyUIError::Sdk(sdk_error) => {
|
||||
// 根据 SDK 错误类型判断是否可重试
|
||||
matches!(sdk_error,
|
||||
comfyui_sdk::error::ComfyUIError::Http(_) |
|
||||
comfyui_sdk::error::ComfyUIError::Timeout(_) |
|
||||
comfyui_sdk::error::ComfyUIError::Connection(_)
|
||||
)
|
||||
// 检查 SDK 错误字符串是否包含可重试的错误类型
|
||||
sdk_error.contains("Http") ||
|
||||
sdk_error.contains("Timeout") ||
|
||||
sdk_error.contains("Connection")
|
||||
}
|
||||
_ => false,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ impl ServiceManager {
|
|||
}
|
||||
|
||||
// 初始化数据库
|
||||
self.repository.initialize().await?;
|
||||
self.repository.initialize()?;
|
||||
|
||||
// 获取配置
|
||||
let config = self.config_manager.get_comfyui_config().await;
|
||||
|
|
|
|||
Loading…
Reference in New Issue