refactor(lib): use transparent error types instead of self-referring

This commit is contained in:
Orhun Parmaksız 2022-02-15 03:44:05 +03:00
parent 0d82705d1c
commit 3aff544216
No known key found for this signature in database
GPG key ID: F83424824B3E4B90
3 changed files with 9 additions and 9 deletions

View file

@ -16,10 +16,10 @@ pub enum Error {
#[error("JSON de/serialization error: `{0}`")]
SerdeJsonError(#[from] serde_json::Error),
/// Error that may occur due to system time related anomalies.
#[error("System time error: `{0}`")]
#[error("system time error: `{0}`")]
SystemTimeError(#[from] std::time::SystemTimeError),
/// Error that may occur while parsing documents.
#[error("parser error: `{0}`")]
#[error(transparent)]
ParseError(#[from] systeroid_parser::error::Error),
/// Error that may occur while handling sysctl operations.
#[error("sysctl error: `{0}`")]

View file

@ -4,7 +4,7 @@ use thiserror::Error as ThisError;
#[derive(Debug, ThisError)]
pub enum Error {
/// Error that may occur during I/O operations.
#[error("IO error: '{0}'")]
#[error("IO error: `{0}`")]
IoError(#[from] std::io::Error),
/// Error that may occur due to invalid UTF-8 strings.
#[error("non-UTF-8 string")]
@ -16,12 +16,12 @@ pub enum Error {
#[error("could not find any files to parse")]
EmptyFileListError,
/// Error that may occur when a required file for parsing does not exist.
#[error("required file missing: '{0}'")]
#[error("required file missing: `{0}`")]
MissingFileError(String),
/// Error that may occur while traversing paths using a glob pattern.
#[error("glob error: '{0}'")]
#[error("glob error: `{0}`")]
GlobError(#[from] globwalk::GlobError),
/// Error that may occur during the compilation of a regex.
#[error("regex error: '{0}'")]
#[error("regex error: `{0}`")]
RegexError(#[from] regex::Error),
}

View file

@ -7,16 +7,16 @@ pub enum Error {
#[error("IO error: `{0}`")]
IoError(#[from] std::io::Error),
/// Error that may occur while receiving messages from the channel.
#[error("Channel receive error: `{0}`")]
#[error("channel receive error: `{0}`")]
ChannelReceiveError(#[from] std::sync::mpsc::RecvError),
/// Error that may occur while getting/setting the contents of the clipboard.
#[error("Clipboard error: `{0}`")]
#[error("clipboard error: `{0}`")]
ClipboardError(String),
/// Error that may occur while parsing a color.
#[error(transparent)]
ColorParseError(#[from] colorsys::ParseError),
/// Error that may occur in the core library.
#[error("{0}")]
#[error(transparent)]
SysctlError(#[from] systeroid_core::error::Error),
}