pub enum Error {
Network {
url: String,
source: BoxError,
},
Status {
url: String,
status: u16,
retry_after: Option<f64>,
},
BodyTooLarge {
url: String,
limit: usize,
},
RobotsDenied(String),
InvalidUrl(String),
Parse(String),
Provider {
provider: String,
message: String,
},
Browser(String),
Config(String),
}Expand description
Everything that can go wrong inside rustai.
Variants§
Network
The remote host could not be reached, timed out, or returned a transport-level failure.
Fields
Status
The server answered, but with a status we treat as a failure.
Fields
BodyTooLarge
Response body exceeded crate::http::FetchConfig::max_body_bytes.
RobotsDenied(String)
robots.txt disallows this path for our user-agent.
InvalidUrl(String)
A URL could not be parsed or was not http(s).
Parse(String)
The HTML could not be parsed.
Provider
A search or feed provider returned something we could not read.
Browser(String)
Headless-browser fallback failed or is not compiled in.
Config(String)
Invalid configuration supplied by the caller.
Implementations§
Source§impl Error
impl Error
Sourcepub fn retry_after(&self) -> Option<Duration>
pub fn retry_after(&self) -> Option<Duration>
How long the server asked us to wait before trying again, if it said.
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
Whether retrying the same request could plausibly succeed.
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 Forget for Error
impl Freeze for Error
impl Move 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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more