Files
Genarrative/server-rs/crates/module-editor-agent/src/errors.rs
T
kdletters 8dad52f040 实现画布Agent侧边栏聊天
新增画布Agent会话契约、领域规则、SpacetimeDB元数据表和生成绑定。
新增api-server画布Agent会话CRUD、OSS消息文档读写、SSE消息流和生成工具编排。
新增前端右侧Agent对话面板、会话状态hook、SSE客户端、BFF客户端和相关测试。
调整画布侧栏、任务栏、小地图默认状态和面板互斥交互。
补齐画布Agent、OSS消息存储、SSE收口、后端契约和项目记忆文档。
2026-07-04 12:03:58 +08:00

34 lines
1.2 KiB
Rust

use std::{error::Error, fmt};
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum EditorAgentError {
MissingConversationId,
MissingProjectId,
MissingOwnerUserId,
MissingMessageId,
EmptyMessage,
TooManyAttachments,
InvalidAttachmentReference,
ConversationDeleted,
NotConversationOwner,
}
impl fmt::Display for EditorAgentError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let message = match self {
Self::MissingConversationId => "editor agent conversation_id 缺失",
Self::MissingProjectId => "editor agent project_id 缺失",
Self::MissingOwnerUserId => "editor agent owner_user_id 缺失",
Self::MissingMessageId => "editor agent message_id 缺失",
Self::EmptyMessage => "消息内容为空(文本与附件均缺失)",
Self::TooManyAttachments => "单条消息附件超过上限",
Self::InvalidAttachmentReference => "附件引用缺少资源标识",
Self::ConversationDeleted => "会话已删除",
Self::NotConversationOwner => "当前用户不是会话拥有者",
};
write!(f, "{message}")
}
}
impl Error for EditorAgentError {}