Remove ErrorString
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
pub use tool_helper::{Error, ErrorString};
|
pub use tool_helper::Error;
|
||||||
|
|
||||||
pub mod config_reader;
|
pub mod config_reader;
|
||||||
pub mod encoder;
|
pub mod encoder;
|
||||||
|
|||||||
@@ -21,10 +21,6 @@ macro_rules! format_if_error {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait ErrorString {
|
|
||||||
fn to_string(self) -> String;
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct Error {
|
pub struct Error {
|
||||||
pub exit_code: i32,
|
pub exit_code: i32,
|
||||||
pub action: String,
|
pub action: String,
|
||||||
@@ -109,12 +105,6 @@ impl std::convert::From<std::convert::Infallible> for Error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: ErrorString> std::convert::From<T> for Error {
|
|
||||||
fn from(error: T) -> Self {
|
|
||||||
Error::from_text(error.to_string())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn prefix_if_error<T>(prefix: &str, result: Result<T, Error>) -> Result<T, Error> {
|
pub fn prefix_if_error<T>(prefix: &str, result: Result<T, Error>) -> Result<T, Error> {
|
||||||
match result {
|
match result {
|
||||||
Ok(value) => Ok(value),
|
Ok(value) => Ok(value),
|
||||||
|
|||||||
Reference in New Issue
Block a user