pub enum Error {
Transport(Error),
Api {
status: u16,
code: ErrorCode,
response: ErrorResponse,
},
UnknownCode {
status: u16,
code: String,
message: String,
question_id: Option<String>,
},
Unexpected {
status: u16,
body: String,
},
MissingAnswer(String),
WrongType {
id: String,
expected: &'static str,
actual: &'static str,
},
}Variants§
Transport(Error)
Api
The service answered with a structured failure. Branch on code, not on the message.
UnknownCode
A structured failure with a code this client does not know, from a newer service.
Kept apart from Error::Unexpected because it is not a proxy getting in the way: the
service answered, in its own shape, and the code and message are worth reading. Updating
the client turns it into an Error::Api.
Unexpected
A response that was not shaped like anything cerno sends — a proxy or a gateway between
client and service, most likely. body is kept whole; the message shows its start, as
the Python and TypeScript clients do, so a gateway’s HTML page does not fill a log line.
MissingAnswer(String)
WrongType
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