Enum automatons::Error
source · [−]Expand description
Errors that an automaton can return
When an automaton executes its tasks, things can fail. Automatons might interact with external
resources or third-party APIs that are unreliable, the configuration might be wrong, or
something totally unexpected might happen. In these situations, automatons can abort their
execution and return an [Error
].
Example
The implementation of the error type is based on thiserror and anyhow. Unexpected errors can
easily be converted to an error by calling .context
on the original error.
use std::io::ErrorKind;
use anyhow::Context;
use automatons::Error;
fn connect() -> Result<(), Error> {
let failure = Err(std::io::Error::new(ErrorKind::TimedOut, "connection timed out"));
let error = failure.context("failed to connect to API due to connection time out")?;
Ok(())
}
anyhow: https://crates.io/crates/anyhow thiserror: https://crates.io/crates/thiserror
Variants
Configuration(String)
NotFound(String)
Serialization(String)
Unknown(Error)
Trait Implementations
sourceimpl Error for Error
impl Error for Error
sourcefn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
The lower-level source of this error, if any. Read more
1.0.0 · sourcefn 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 Send for Error
impl Sync for Error
impl Unpin for Error
impl !UnwindSafe for Error
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more