31 lines
868 B
Rust
31 lines
868 B
Rust
//! Generic Rusty MIDI Commander error
|
|
//!
|
|
|
|
use thiserror::Error;
|
|
|
|
/// A generic error for the Rusty Midi Commander.
|
|
///
|
|
/// # Example Usage
|
|
/// ```
|
|
/// use rmc_lib::RustyMidiError;
|
|
///
|
|
/// match Some(reqwest::Error::new(reqwest::StatusCode::NotFound)) {
|
|
/// None => println!("No error"),
|
|
/// Some(err) => return Err(RustyMidiError::NetworkRequest(err)),
|
|
/// }
|
|
/// ```
|
|
#[derive(Error, Debug)]
|
|
pub enum RustyMidiError {
|
|
#[error("network request failed {0}")]
|
|
NetworkRequest(#[from] reqwest::Error),
|
|
|
|
#[error("an error occured while accessing a file {0}")]
|
|
IO(#[from] std::io::Error),
|
|
|
|
#[error("an error occured while trying to deserialize the config file {0}")]
|
|
RonSerialization(#[from] ron::de::SpannedError),
|
|
|
|
#[error("an error occured while trying to serialize the config file {0}")]
|
|
RonDeSerialization(#[from] ron::Error),
|
|
}
|