mirror of
https://github.com/anthonyoteri/dredge.git
synced 2026-06-05 23:36:53 -04:00
Miscellaneous code cleanup
This commit is contained in:
@@ -21,10 +21,6 @@ use thiserror::Error;
|
||||
/// The common error type for this Application.
|
||||
#[derive(Error, Debug)]
|
||||
pub enum DredgeError {
|
||||
/// An error related to the configuration of the program.
|
||||
#[error(transparent)]
|
||||
ConfigError(#[from] ConfigError),
|
||||
|
||||
/// An error communicating with the Registry API
|
||||
#[error(transparent)]
|
||||
ApiError(#[from] ApiError),
|
||||
@@ -34,40 +30,6 @@ pub enum DredgeError {
|
||||
RegistryUrlError(String),
|
||||
}
|
||||
|
||||
/// An error related to the configuration fo the program.
|
||||
#[derive(Error, Debug)]
|
||||
pub enum ConfigError {
|
||||
/// An error parsing the configuration from disk.
|
||||
#[error("Failed to parse configuration file")]
|
||||
ParseError(Box<dyn std::error::Error>),
|
||||
|
||||
/// An error writing the configuration to disk.
|
||||
#[error("Failed to write configuration data")]
|
||||
WriteError(Box<dyn std::error::Error>),
|
||||
|
||||
/// A generic IOError
|
||||
#[error(transparent)]
|
||||
IOError(#[from] std::io::Error),
|
||||
}
|
||||
|
||||
impl From<toml::ser::Error> for ConfigError {
|
||||
fn from(other: toml::ser::Error) -> Self {
|
||||
Self::WriteError(Box::from(other))
|
||||
}
|
||||
}
|
||||
|
||||
impl From<toml::de::Error> for ConfigError {
|
||||
fn from(other: toml::de::Error) -> Self {
|
||||
Self::ParseError(Box::from(other))
|
||||
}
|
||||
}
|
||||
|
||||
impl From<xdg::BaseDirectoriesError> for ConfigError {
|
||||
fn from(other: xdg::BaseDirectoriesError) -> Self {
|
||||
Self::WriteError(Box::from(other))
|
||||
}
|
||||
}
|
||||
|
||||
/// An error related to the communication with the registry API.
|
||||
#[derive(Error, Debug)]
|
||||
pub enum ApiError {
|
||||
|
||||
Reference in New Issue
Block a user