This repository has been archived on 2026-09-13. You can view files and clone it, but cannot push or open issues or pull requests.
rusty_midi_commander/src/error.rs

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),
}