use sea_orm::DbErr;
use signer_core::SignerError;
use crate::crdt::errors::CrdtError;
#[derive(Debug, thiserror::Error)]
pub enum ViewError {
#[error(transparent)]
DbError(#[from] sea_orm::DbErr),
#[error(transparent)]
SerdeJsonError(#[from] serde_json::Error),
#[error(transparent)]
DeltaError(#[from] DeltaError),
#[error("signer-core 错误: {0}")]
SignerError(#[from] SignerError),
#[error("无效的视图对象错误: {0}")]
InvalidViewObjectError(String),
#[error("io 错误: {0}")]
IoError(#[from] std::io::Error),
#[error("crdt 错误: {0}")]
CrdtError(#[from] CrdtError),
#[error("crdt 协调错误: {0}")]
ReconcileError(#[from] ReconcileError),
#[error(transparent)]
MessageViewFromModelError(#[from] MessageViewFromModelError),
#[error("其他错误: {0}")]
OtherError(String),
}
#[derive(Debug, thiserror::Error)]
pub enum MessageViewFromModelError {
#[error("数据库错误: {0}")]
DbError(#[from] sea_orm::DbErr),
#[error("io 错误: {0}")]
IoError(#[from] std::io::Error),
#[error("JSON 错误: {0}")]
JsonError(#[from] serde_json::Error),
}
#[derive(Debug, thiserror::Error)]
pub enum DeltaError {
#[error(transparent)]
ViewError(#[from] Box<ViewError>),
#[error("无效的参数错误: {0}")]
InvalidParamsError(String),
#[error("io 错误: {0}")]
IoError(#[from] std::io::Error),
}
#[derive(Debug, thiserror::Error)]
pub enum ReconcileError {
#[error("数据库错误: {0}")]
DbErr(#[from] DbErr),
#[error("crdt 错误: {0}")]
CrdtError(#[from] CrdtError),
#[error("处理 JSON 时出现错误: {0}")]
JsonError(#[from] serde_json::Error),
}