From aa619e862daeae9f94449dc16da5096d59c56954 Mon Sep 17 00:00:00 2001 From: Joakim Soderlund Date: Sat, 10 Aug 2019 20:28:41 +0000 Subject: [PATCH] Add error kind for queries --- src/error.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/error.rs b/src/error.rs index 3102d5e..a790bb4 100644 --- a/src/error.rs +++ b/src/error.rs @@ -17,6 +17,7 @@ pub enum ErrorKind { IndexError, InvalidStory, UsageError, + QueryError, } #[derive(Debug)] @@ -72,6 +73,10 @@ impl Error { ErrorBuilder::new(UsageError).message(message).build() } + pub fn query(message: impl ToString) -> Self { + ErrorBuilder::new(QueryError).message(message).build() + } + pub fn kind(&self) -> ErrorKind { self.kind.clone() } @@ -99,6 +104,7 @@ impl Display for ErrorKind { IndexError => "Index error", InvalidStory => "Invalid story", UsageError => "Usage error", + QueryError => "Query error", }; write!(f, "{}", message)