Remove StoreError::expl member

This commit is contained in:
Matthias Beyer 2016-01-16 14:08:39 +01:00
parent b74e0f713f
commit e467c1e8ec

View file

@ -42,18 +42,16 @@ impl Display for StoreErrorType {
pub struct StoreError { pub struct StoreError {
err_type: StoreErrorType, err_type: StoreErrorType,
expl: &'static str,
cause: Option<Box<Error>>, cause: Option<Box<Error>>,
} }
impl StoreError { impl StoreError {
pub fn new(errtype: StoreErrorType, expl: &'static str, cause: Option<Box<Error>>) pub fn new(errtype: StoreErrorType, cause: Option<Box<Error>>)
-> StoreError -> StoreError
{ {
StoreError { StoreError {
err_type: errtype, err_type: errtype,
expl: expl,
cause: cause, cause: cause,
} }
} }
@ -67,8 +65,8 @@ impl StoreError {
impl Debug for StoreError { impl Debug for StoreError {
fn fmt(&self, fmt: &mut Formatter) -> Result<(), FmtError> { fn fmt(&self, fmt: &mut Formatter) -> Result<(), FmtError> {
try!(write!(fmt, "[{:?}]: {:?}, caused: {:?}", try!(write!(fmt, "[{:?}]: caused by: {:?}",
self.err_type, self.expl, self.cause)); self.err_type, self.cause));
Ok(()) Ok(())
} }
@ -77,9 +75,7 @@ impl Debug for StoreError {
impl Display for StoreError { impl Display for StoreError {
fn fmt(&self, fmt: &mut Formatter) -> Result<(), FmtError> { fn fmt(&self, fmt: &mut Formatter) -> Result<(), FmtError> {
try!(write!(fmt, "[{}]: {}", try!(write!(fmt, "[{}]", store_error_type_as_str(&self.err_type.clone())));
store_error_type_as_str(&self.err_type.clone()),
self.expl));
Ok(()) Ok(())
} }
@ -88,7 +84,7 @@ impl Display for StoreError {
impl Error for StoreError { impl Error for StoreError {
fn description(&self) -> &str { fn description(&self) -> &str {
self.expl store_error_type_as_str(&self.err_type.clone())
} }
fn cause(&self) -> Option<&Error> { fn cause(&self) -> Option<&Error> {