ravenous-tools/weaponry/src/error.rs

61 lines
2.0 KiB
Rust

// Workspace: weaponry
// File: weaponry/src/error.rs
//! Inner weaponry error definition
#![allow(missing_docs, clippy::missing_docs_in_private_items)]
use charming::EchartsError;
use thiserror::Error;
#[derive(Error, Debug)]
/// Unrecoverable Error, all these error cannot gracefully fail and must return to the User for further handling
pub enum FatalEquipementError {
#[error("Rusqlite failed to connect to the given path {0}")]
RusqliteConnection(#[from] rusqlite::Error),
#[error("Deserialization from object failed : rowid {row_id} \n{error}")]
SerdeRusqlite {
error: serde_rusqlite::Error,
row_id: usize,
},
#[error("Deserialisation from json failed : {0}")]
SerdeJSON(#[from] serde_json::Error),
#[error(
"Deserialisation from json failed at line {line} on file {file} while trying to parse the value: {parsed_value}: {error}]"
)]
SerdeJSONAt {
line: String,
file: String,
error: serde_json::Error,
parsed_value: String,
},
#[error("Couldn't convert into type {origin_type} with data {data}")]
Conversion { origin_type: String, data: String },
#[error("An error occured with your current CLI configuration: {0}")]
CLISelection(String),
#[error("Couldn't save the chart as an error occured during the process : {0}")]
SaveCharmingChart(#[from] EchartsError),
}
// #[derive(Error, Debug)]
// /// Recoverable error, all these error exist to signal a retry or another path that should be taken by the program
// pub enum LocalEquipementError {
// #[error("Very simple error")]
// Oops,
// }
// #[derive(Error, Debug)]
// /// An equipement error, either unrecoverable, indicating a that the execution
// /// flow must be stopped and only an user input can solve the issue
// pub enum EquipementError {
// #[error("An unrecoverable error occured: {0}")]
// Fatal(#[from] FatalEquipementError),
// #[error("A local error occured an wasn't recovered from: {0}")]
// Local(#[from] LocalEquipementError),
// }