mirror of
https://github.com/JockeTF/fimfareader.git
synced 2024-11-27 07:28:00 +01:00
Add error kind for queries
This commit is contained in:
parent
2e86fe6c25
commit
aa619e862d
1 changed files with 6 additions and 0 deletions
|
@ -17,6 +17,7 @@ pub enum ErrorKind {
|
||||||
IndexError,
|
IndexError,
|
||||||
InvalidStory,
|
InvalidStory,
|
||||||
UsageError,
|
UsageError,
|
||||||
|
QueryError,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
@ -72,6 +73,10 @@ impl Error {
|
||||||
ErrorBuilder::new(UsageError).message(message).build()
|
ErrorBuilder::new(UsageError).message(message).build()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn query(message: impl ToString) -> Self {
|
||||||
|
ErrorBuilder::new(QueryError).message(message).build()
|
||||||
|
}
|
||||||
|
|
||||||
pub fn kind(&self) -> ErrorKind {
|
pub fn kind(&self) -> ErrorKind {
|
||||||
self.kind.clone()
|
self.kind.clone()
|
||||||
}
|
}
|
||||||
|
@ -99,6 +104,7 @@ impl Display for ErrorKind {
|
||||||
IndexError => "Index error",
|
IndexError => "Index error",
|
||||||
InvalidStory => "Invalid story",
|
InvalidStory => "Invalid story",
|
||||||
UsageError => "Usage error",
|
UsageError => "Usage error",
|
||||||
|
QueryError => "Query error",
|
||||||
};
|
};
|
||||||
|
|
||||||
write!(f, "{}", message)
|
write!(f, "{}", message)
|
||||||
|
|
Loading…
Reference in a new issue