baichun_framework_core/
error.rs1use thiserror::Error;
2
3#[derive(Debug, Error)]
5pub enum Error {
6 #[error("IO错误: {0}")]
7 Io(#[from] std::io::Error),
8
9 #[error("序列化错误: {0}")]
10 Serialization(#[from] serde_json::Error),
11
12 #[error("验证错误: {0}")]
13 Validation(String),
14
15 #[error("认证错误: {0}")]
16 Authentication(String),
17
18 #[error("授权错误: {0}")]
19 Authorization(String),
20
21 #[error("业务错误: {0}")]
22 Business(String),
23
24 #[error("系统错误: {0}")]
25 System(String),
26
27 #[error("未知错误: {0}")]
28 Unknown(String),
29}
30
31pub type Result<T> = std::result::Result<T, Error>;