simplisp/error/
wrap_err.rs

1use std::error::Error;
2use error::Result as LispResult;
3use error::WrapError;
4
5pub trait WrapErr<TResult> {
6    fn wrap_err_to_err(self) -> LispResult<TResult>;
7}
8
9impl <TResult, TError> WrapErr<TResult> for Result<TResult, TError>
10    where TError: Error + Send + 'static {
11    fn wrap_err_to_err(self) -> LispResult<TResult> {
12        match self  {
13            Ok(ok) => Ok(ok),
14            Err(error) => error.wrap_error_to_err(),
15        }
16    }
17}