pub enum Error {
WithContext(Box<Error>, String),
BadArgument(String),
IO(String),
Request(String),
Decode(String),
QueryFailed(ErrorCode),
Logic(StatusCode, ErrorCode),
Response {
status: StatusCode,
msg: String,
},
QueryNotFound(String),
AuthFailure(ErrorCode),
}
Variants§
WithContext(Box<Error>, String)
BadArgument(String)
errors detected before sending request. e.g. invalid DSN, header value, stage name.
IO(String)
errors when
- accessing local file and presign_url
- From(std::io::Error)
Request(String)
send request error
Decode(String)
http handler return 200, but body is invalid
- failed to decode body to Utf8 or JSON
- failed to decode result data
QueryFailed(ErrorCode)
http handler return 200, but query failed (.error != null)
Logic(StatusCode, ErrorCode)
http handler return non-200, with JSON body of type QueryError.
Response
other non-200 response
QueryNotFound(String)
the flowing are more detail type of Logic
possible reasons:
- expired: if you have not polled the next_page_uri for too long, the session will be expired, you’ll get a 404 on accessing this next page uri.
- routed to another server
- server restarted
TODO: try to distinguish them
AuthFailure(ErrorCode)
Implementations§
Source§impl Error
impl Error
pub fn response_error(status: StatusCode, body: &[u8]) -> Self
pub fn with_context(self, ctx: &str) -> Self
pub fn status_code(&self) -> Option<StatusCode>
Trait Implementations§
Source§impl Error for Error
impl Error for Error
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()
Source§impl From<InvalidHeaderValue> for Error
only used in make_headers
impl From<InvalidHeaderValue> for Error
only used in make_headers
Source§fn from(e: InvalidHeaderValue) -> Self
fn from(e: InvalidHeaderValue) -> Self
Converts to this type from the input type.
Source§impl From<ParseError> for Error
impl From<ParseError> for Error
Source§fn from(e: ParseError) -> Self
fn from(e: ParseError) -> Self
Converts to this type from the input type.
Source§impl From<ParseIntError> for Error
impl From<ParseIntError> for Error
Source§fn from(e: ParseIntError) -> Self
fn from(e: ParseIntError) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for Error
impl RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnwindSafe 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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string
, but without panic on OOM.