Convert query-pull/ to PullError.

This commit is contained in:
Nick Alexander 2018-06-27 11:53:02 -07:00
parent 0e4991fa26
commit d6569a6a22
2 changed files with 15 additions and 6 deletions

View file

@ -10,15 +10,15 @@
use std; // To refer to std::result::Result. use std; // To refer to std::result::Result.
use mentat_db::{
DbError,
};
use mentat_core::{ use mentat_core::{
Entid, Entid,
}; };
use failure::{ pub type Result<T> = std::result::Result<T, PullError>;
Error,
};
pub type Result<T> = std::result::Result<T, Error>;
#[derive(Debug, Fail)] #[derive(Debug, Fail)]
pub enum PullError { pub enum PullError {
@ -27,4 +27,13 @@ pub enum PullError {
#[fail(display = ":db/id repeated")] #[fail(display = ":db/id repeated")]
RepeatedDbId, RepeatedDbId,
#[fail(display = "{}", _0)]
DbError(#[cause] DbError),
}
impl From<DbError> for PullError {
fn from(error: DbError) -> PullError {
PullError::DbError(error)
}
} }

View file

@ -102,7 +102,7 @@ use mentat_query::{
pub mod errors; pub mod errors;
use errors::{ pub use errors::{
PullError, PullError,
Result, Result,
}; };