mirror of
https://github.com/Yuyi-Oak/BlueArchiveToolkit.git
synced 2026-07-22 09:15:15 +08:00
feat: implement production cas v1
This commit is contained in:
@@ -22,6 +22,14 @@ pub enum CasError {
|
||||
#[error("Object not found: {0}")]
|
||||
ObjectNotFound(String),
|
||||
|
||||
/// Hash 格式无效
|
||||
#[error("Invalid hash: {0}")]
|
||||
InvalidHash(String),
|
||||
|
||||
/// 引用计数下溢
|
||||
#[error("Reference count is already zero: {0}")]
|
||||
ReferenceUnderflow(String),
|
||||
|
||||
/// 数据库错误
|
||||
#[error("Database error: {0}")]
|
||||
Database(String),
|
||||
@@ -33,3 +41,9 @@ pub enum CasError {
|
||||
|
||||
/// CAS Engine Result 类型
|
||||
pub type Result<T> = std::result::Result<T, CasError>;
|
||||
|
||||
impl From<sqlx::Error> for CasError {
|
||||
fn from(error: sqlx::Error) -> Self {
|
||||
Self::Database(error.to_string())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user