pub struct ApiError {
pub status: u16,
pub code: ErrorCode,
pub message: String,
pub details: Option<Value>,
}Expand description
Core’s error envelope plus the HTTP status it came with.
Fields§
§status: u16HTTP status of the response (401, 403, 404, 409, 422, …).
code: ErrorCodeMachine-readable error.code; match on this, not on the message.
message: StringHuman-readable error.message, as Core wrote it.
details: Option<Value>Structured detail, e.g. the list of violated zone rules on 409/422.
Implementations§
Source§impl ApiError
impl ApiError
Sourcepub fn managed(&self) -> Option<(&str, &str)>
pub fn managed(&self) -> Option<(&str, &str)>
For ErrorCode::ManagedRecord and ErrorCode::ManagedCertificate: who keeps
the resource (Redirect, Acme) and the name it is kept for (the redirect’s host
name). None for other errors.
Sourcepub fn import_report(&self) -> Option<ImportReport>
pub fn import_report(&self) -> Option<ImportReport>
For ErrorCode::ImportFailed: the import report Core sends in details (which
records were refused and why). None for other errors, or if details does not
have the report’s shape.
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