Add Other variant for the Error type

This commit is contained in:
Kelvin Ly 2017-05-19 23:48:06 -04:00
parent cd824aeaee
commit 022f1e8671

View File

@ -74,6 +74,9 @@ pub enum Error {
#[cfg(feature = "functions")]
#[allow(dead_code)]
UserFunctionError(Box<error::Error + Send + Sync>),
/// Error available for the implementors of the `FromSql` trait.
Other(Box<error::Error + Send + Sync>),
}
impl From<str::Utf8Error> for Error {
@ -128,6 +131,7 @@ impl fmt::Display for Error {
}
#[cfg(feature = "functions")]
Error::UserFunctionError(ref err) => err.fmt(f),
Error::Other(ref err) => err.fmt(f),
}
}
}
@ -159,6 +163,7 @@ impl error::Error for Error {
Error::InvalidFunctionParameterType(_, _) => "invalid function parameter type",
#[cfg(feature = "functions")]
Error::UserFunctionError(ref err) => err.description(),
Error::Other(ref err) => err.description(),
}
}
@ -185,6 +190,7 @@ impl error::Error for Error {
#[cfg(feature = "functions")]
Error::UserFunctionError(ref err) => Some(&**err),
Error::Other(ref err) => Some(&**err),
}
}
}