pub enum Error {
Api(ApiError),
Transport(Error),
Decode {
status: u16,
snippet: String,
},
InvalidInput(String),
NotFound(String),
}Expand description
Everything an SDK call can fail with.
§Examples
Telling “does not exist” apart from other failures:
use dinio_sdk::{Error, ErrorCode};
match client.zones().get("example.com").await {
Ok(zone) => println!("zone {}", zone.uuid),
Err(Error::Api(err)) if err.code == ErrorCode::NotFound => println!("no such zone"),
Err(err) => return Err(err),
}Variants§
Api(ApiError)
Core answered with its error envelope (success: false).
Transport(Error)
The request never got a response: DNS, TLS, connection, timeout.
Decode
Core (or something in front of it, e.g. a proxy) answered with something that is not the expected envelope.
Fields
InvalidInput(String)
Rejected by the SDK before sending anything (bad URL, bad argument).
NotFound(String)
A name-based operation found nothing to act on (e.g. no record value with that data).
Trait Implementations§
Source§impl Error for Error
impl Error for Error
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 !RefUnwindSafe for Error
impl !UnwindSafe for Error
impl Freeze for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnsafeUnpin for Error
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