arfur_wpilib/
error.rs

1//! Library-wide error types.
2//!
3//! This stores two important types: [`enum@Error`], which can be made from any error
4//! type in this crate, and [`Result<T>`], which is a type alias to `Result<T,
5//! Error>`.
6//!
7//! Any error in this library can be losslessly converted to this type.
8
9use thiserror::Error;
10
11/// A generic error type for all `arfur`-related errors. Implements `From<E>` where `E` is an error type from this crate.
12#[derive(Error, Clone, Debug, PartialEq, Eq)]
13pub enum Error {
14    #[error(transparent)]
15    InitializationError(#[from] super::robot::InitializationError),
16    #[error("unknown")]
17    Unknown,
18}
19
20/// A wrapper around [`std::result::Result`] that uses [`enum@Error`] as the error type.
21pub type Result<T> = std::result::Result<T, Error>;