#[non_exhaustive]pub struct ApiError {
pub errors: Vec<ApiErrorEntry>,
}Expand description
One or more errors returned by Namecheap inside an XML response.
Namecheap signals failures with Status="ERROR" on the response envelope and
lists the individual problems in an <Errors> element. Each entry carries a
numeric code and a human-readable message; inspect ApiError::errors (or
use ApiError::has_code) to branch on specific codes.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.errors: Vec<ApiErrorEntry>The individual errors reported by the API, in the order returned.
Implementations§
Source§impl ApiError
impl ApiError
Sourcepub fn has_code(&self, code: &str) -> bool
pub fn has_code(&self, code: &str) -> bool
Returns true if any returned error carries the given numeric code.
Codes are compared as strings because Namecheap documents them that way
(for example "2030280" for “TLD is not supported”).
Sourcepub fn first(&self) -> Option<&ApiErrorEntry>
pub fn first(&self) -> Option<&ApiErrorEntry>
Returns the first reported error, if any.
Trait Implementations§
Source§impl Error for ApiError
impl Error for ApiError
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()
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