use anyhow::Result;
pub type StateResult<T> = Result<T>;
#[allow(clippy::module_inception)]
pub mod error {
use anyhow::anyhow;
pub fn plugin_init_error(msg: impl Into<String>) -> anyhow::Error {
anyhow!("插件状态初始化失败: {}", msg.into())
}
pub fn plugin_apply_error(msg: impl Into<String>) -> anyhow::Error {
anyhow!("插件状态应用失败: {}", msg.into())
}
pub fn transaction_error(msg: impl Into<String>) -> anyhow::Error {
anyhow!("事务应用失败: {}", msg.into())
}
pub fn configuration_error(msg: impl Into<String>) -> anyhow::Error {
anyhow!("配置错误: {}", msg.into())
}
pub fn field_error(msg: impl Into<String>) -> anyhow::Error {
anyhow!("字段操作失败: {}", msg.into())
}
pub fn schema_error(msg: impl Into<String>) -> anyhow::Error {
anyhow!("Schema错误: {}", msg.into())
}
pub fn plugin_not_found(msg: impl Into<String>) -> anyhow::Error {
anyhow!("插件未找到: {}", msg.into())
}
pub fn invalid_plugin_state(msg: impl Into<String>) -> anyhow::Error {
anyhow!("插件状态无效: {}", msg.into())
}
pub fn serialize_error(msg: impl Into<String>) -> anyhow::Error {
anyhow!("序列化失败: {}", msg.into())
}
pub fn deserialize_error(msg: impl Into<String>) -> anyhow::Error {
anyhow!("反序列化失败: {}", msg.into())
}
}