pub struct CloudError {
pub code: String,
pub message: String,
pub status: Option<u16>,
pub details: Option<Value>,
}Expand description
云服务错误类型
Fields§
§code: String错误代码
message: String错误消息
status: Option<u16>HTTP 状态码
details: Option<Value>附加详情
Implementations§
Source§impl CloudError
impl CloudError
Sourcepub fn internal(message: impl Into<String>) -> CloudError
pub fn internal(message: impl Into<String>) -> CloudError
创建内部错误
Sourcepub fn invalid_param(
param: impl Into<String>,
reason: impl Into<String>,
) -> CloudError
pub fn invalid_param( param: impl Into<String>, reason: impl Into<String>, ) -> CloudError
创建无效参数错误
Sourcepub fn not_found(resource: impl Into<String>) -> CloudError
pub fn not_found(resource: impl Into<String>) -> CloudError
创建未找到错误
Sourcepub fn permission_denied(action: impl Into<String>) -> CloudError
pub fn permission_denied(action: impl Into<String>) -> CloudError
创建权限错误
Sourcepub fn timeout(operation: impl Into<String>) -> CloudError
pub fn timeout(operation: impl Into<String>) -> CloudError
创建超时错误
创建服务不可用错误
Sourcepub fn with_status(self, status: u16) -> CloudError
pub fn with_status(self, status: u16) -> CloudError
设置 HTTP 状态码
Sourcepub fn with_details(self, details: Value) -> CloudError
pub fn with_details(self, details: Value) -> CloudError
设置附加详情
Trait Implementations§
Source§impl Clone for CloudError
impl Clone for CloudError
Source§fn clone(&self) -> CloudError
fn clone(&self) -> CloudError
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CloudError
impl Debug for CloudError
Source§impl<'de> Deserialize<'de> for CloudError
impl<'de> Deserialize<'de> for CloudError
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<CloudError, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<CloudError, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for CloudError
impl Display for CloudError
Source§impl Error for CloudError
impl Error for CloudError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Source§impl From<WaeError> for CloudError
impl From<WaeError> for CloudError
Source§fn from(err: WaeError) -> CloudError
fn from(err: WaeError) -> CloudError
Converts to this type from the input type.
Source§impl Serialize for CloudError
impl Serialize for CloudError
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for CloudError
impl RefUnwindSafe for CloudError
impl Send for CloudError
impl Sync for CloudError
impl Unpin for CloudError
impl UnsafeUnpin for CloudError
impl UnwindSafe for CloudError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more