|
@ -8,7 +8,7 @@ pub struct Error { |
|
|
impl Error {
|
|
|
impl Error {
|
|
|
pub fn prefix(&self, prefix: &str) -> Self {
|
|
|
pub fn prefix(&self, prefix: &str) -> Self {
|
|
|
Error {
|
|
|
Error {
|
|
|
message: format!("{}: {}", prefix, &self.message),
|
|
|
|
|
|
|
|
|
message: format!("{prefix}: {}", &self.message),
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@ -41,25 +41,25 @@ impl From<&String> for Error { |
|
|
|
|
|
|
|
|
impl From<std::io::Error> for Error {
|
|
|
impl From<std::io::Error> for Error {
|
|
|
fn from(error: std::io::Error) -> Self {
|
|
|
fn from(error: std::io::Error) -> Self {
|
|
|
format!("IO error: {}", error).into()
|
|
|
|
|
|
|
|
|
format!("IO error: {error}").into()
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
impl From<std::net::AddrParseError> for Error {
|
|
|
impl From<std::net::AddrParseError> for Error {
|
|
|
fn from(error: std::net::AddrParseError) -> Self {
|
|
|
fn from(error: std::net::AddrParseError) -> Self {
|
|
|
format!("{}", error).into()
|
|
|
|
|
|
|
|
|
format!("{error}").into()
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
impl From<std::string::FromUtf8Error> for Error {
|
|
|
impl From<std::string::FromUtf8Error> for Error {
|
|
|
fn from(error: std::string::FromUtf8Error) -> Self {
|
|
|
fn from(error: std::string::FromUtf8Error) -> Self {
|
|
|
format!("UTF-8 error: {}", error).into()
|
|
|
|
|
|
|
|
|
format!("UTF-8 error: {error}").into()
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
impl From<std::sync::mpsc::RecvError> for Error {
|
|
|
impl From<std::sync::mpsc::RecvError> for Error {
|
|
|
fn from(error: std::sync::mpsc::RecvError) -> Self {
|
|
|
fn from(error: std::sync::mpsc::RecvError) -> Self {
|
|
|
format!("MSPC receiver error: {}", error).into()
|
|
|
|
|
|
|
|
|
format!("MSPC receiver error: {error}").into()
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
@ -71,63 +71,63 @@ impl From<std::time::SystemTimeError> for Error { |
|
|
|
|
|
|
|
|
impl From<base64::DecodeError> for Error {
|
|
|
impl From<base64::DecodeError> for Error {
|
|
|
fn from(error: base64::DecodeError) -> Self {
|
|
|
fn from(error: base64::DecodeError) -> Self {
|
|
|
format!("base 64 decode error: {}", error).into()
|
|
|
|
|
|
|
|
|
format!("base 64 decode error: {error}").into()
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
impl From<syslog::Error> for Error {
|
|
|
impl From<syslog::Error> for Error {
|
|
|
fn from(error: syslog::Error) -> Self {
|
|
|
fn from(error: syslog::Error) -> Self {
|
|
|
format!("syslog error: {}", error).into()
|
|
|
|
|
|
|
|
|
format!("syslog error: {error}").into()
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
impl From<toml::de::Error> for Error {
|
|
|
impl From<toml::de::Error> for Error {
|
|
|
fn from(error: toml::de::Error) -> Self {
|
|
|
fn from(error: toml::de::Error) -> Self {
|
|
|
format!("IO error: {}", error).into()
|
|
|
|
|
|
|
|
|
format!("IO error: {error}").into()
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
impl From<serde_json::error::Error> for Error {
|
|
|
impl From<serde_json::error::Error> for Error {
|
|
|
fn from(error: serde_json::error::Error) -> Self {
|
|
|
fn from(error: serde_json::error::Error) -> Self {
|
|
|
format!("IO error: {}", error).into()
|
|
|
|
|
|
|
|
|
format!("IO error: {error}").into()
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
impl From<attohttpc::Error> for Error {
|
|
|
impl From<attohttpc::Error> for Error {
|
|
|
fn from(error: attohttpc::Error) -> Self {
|
|
|
fn from(error: attohttpc::Error) -> Self {
|
|
|
format!("HTTP error: {}", error).into()
|
|
|
|
|
|
|
|
|
format!("HTTP error: {error}").into()
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
impl From<glob::PatternError> for Error {
|
|
|
impl From<glob::PatternError> for Error {
|
|
|
fn from(error: glob::PatternError) -> Self {
|
|
|
fn from(error: glob::PatternError) -> Self {
|
|
|
format!("pattern error: {}", error).into()
|
|
|
|
|
|
|
|
|
format!("pattern error: {error}").into()
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
impl From<tinytemplate::error::Error> for Error {
|
|
|
impl From<tinytemplate::error::Error> for Error {
|
|
|
fn from(error: tinytemplate::error::Error) -> Self {
|
|
|
fn from(error: tinytemplate::error::Error) -> Self {
|
|
|
format!("template error: {}", error).into()
|
|
|
|
|
|
|
|
|
format!("template error: {error}").into()
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
#[cfg(feature = "crypto_openssl")]
|
|
|
#[cfg(feature = "crypto_openssl")]
|
|
|
impl From<native_tls::Error> for Error {
|
|
|
impl From<native_tls::Error> for Error {
|
|
|
fn from(error: native_tls::Error) -> Self {
|
|
|
fn from(error: native_tls::Error) -> Self {
|
|
|
format!("{}", error).into()
|
|
|
|
|
|
|
|
|
format!("{error}").into()
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
#[cfg(feature = "crypto_openssl")]
|
|
|
#[cfg(feature = "crypto_openssl")]
|
|
|
impl From<openssl::error::ErrorStack> for Error {
|
|
|
impl From<openssl::error::ErrorStack> for Error {
|
|
|
fn from(error: openssl::error::ErrorStack) -> Self {
|
|
|
fn from(error: openssl::error::ErrorStack) -> Self {
|
|
|
format!("{}", error).into()
|
|
|
|
|
|
|
|
|
format!("{error}").into()
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
#[cfg(unix)]
|
|
|
#[cfg(unix)]
|
|
|
impl From<nix::Error> for Error {
|
|
|
impl From<nix::Error> for Error {
|
|
|
fn from(error: nix::Error) -> Self {
|
|
|
fn from(error: nix::Error) -> Self {
|
|
|
format!("{}", error).into()
|
|
|
|
|
|
|
|
|
format!("{error}").into()
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|