pub struct ApiError {
pub code: ApiErrorCode,
pub message: Option<String>,
}Expand description
Huawei API error response in the format: <error><code>X</code><message/></error>
Fields§
§code: ApiErrorCodeError code (e.g., 125002, 125003)
message: Option<String>Error message (usually empty)
Implementations§
Source§impl ApiError
impl ApiError
Sourcepub fn error_code(&self) -> &ApiErrorCode
pub fn error_code(&self) -> &ApiErrorCode
Get the error code as the enum variant
Sourcepub fn is_csrf_error(&self) -> bool
pub fn is_csrf_error(&self) -> bool
Check if this is a CSRF token error
Sourcepub fn is_session_error(&self) -> bool
pub fn is_session_error(&self) -> bool
Check if this is a session error
Sourcepub fn is_auth_error(&self) -> bool
pub fn is_auth_error(&self) -> bool
Check if this is an authentication error
Sourcepub fn error_message(&self) -> String
pub fn error_message(&self) -> String
Get a human-readable error message
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ApiError
impl<'de> Deserialize<'de> for ApiError
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ApiError
impl RefUnwindSafe for ApiError
impl Send for ApiError
impl Sync for ApiError
impl Unpin for ApiError
impl UnsafeUnpin for ApiError
impl UnwindSafe for ApiError
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