Integrate unfinished server-rs refactor worklists
This commit is contained in:
@@ -1,5 +1,36 @@
|
||||
//! 资产领域错误落位。
|
||||
//! 资产领域错误。
|
||||
//!
|
||||
//! 字段错误和业务错误在这里收口,HTTP 状态码与 SpacetimeDB 字符串错误由 adapter 映射。
|
||||
|
||||
pub use crate::asset_object_core::AssetObjectFieldError;
|
||||
use std::{error::Error, fmt};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub enum AssetObjectFieldError {
|
||||
MissingBucket,
|
||||
MissingObjectKey,
|
||||
MissingAssetKind,
|
||||
MissingAssetObjectId,
|
||||
MissingBindingId,
|
||||
MissingEntityKind,
|
||||
MissingEntityId,
|
||||
MissingSlot,
|
||||
InvalidVersion,
|
||||
}
|
||||
|
||||
impl fmt::Display for AssetObjectFieldError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
Self::MissingBucket => f.write_str("asset_object.bucket 不能为空"),
|
||||
Self::MissingObjectKey => f.write_str("asset_object.object_key 不能为空"),
|
||||
Self::MissingAssetKind => f.write_str("asset_object.asset_kind 不能为空"),
|
||||
Self::MissingAssetObjectId => f.write_str("asset_object.asset_object_id 不能为空"),
|
||||
Self::MissingBindingId => f.write_str("asset_entity_binding.binding_id 不能为空"),
|
||||
Self::MissingEntityKind => f.write_str("asset_entity_binding.entity_kind 不能为空"),
|
||||
Self::MissingEntityId => f.write_str("asset_entity_binding.entity_id 不能为空"),
|
||||
Self::MissingSlot => f.write_str("asset_entity_binding.slot 不能为空"),
|
||||
Self::InvalidVersion => f.write_str("asset_object.version 必须大于 0"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Error for AssetObjectFieldError {}
|
||||
|
||||
Reference in New Issue
Block a user