recreate most filter error except for the geosearch

This commit is contained in:
Tamo 2021-11-04 17:24:55 +01:00
parent 7328ffb034
commit 8234f9fdf3
No known key found for this signature in database
GPG key ID: 20CD8020AFA88D69
4 changed files with 73 additions and 32 deletions

View file

@ -71,6 +71,10 @@ impl<'a> Error<'a> {
Self { context, kind }
}
pub fn new_from_external(context: Span<'a>, error: impl std::error::Error) -> Self {
Self::new_from_kind(context, ErrorKind::External(error.to_string()))
}
pub fn char(self) -> char {
match self.kind {
ErrorKind::Char(c) => c,

View file

@ -69,6 +69,10 @@ impl<'a> Token<'a> {
pub fn new(position: Span<'a>) -> Self {
Self { position, inner: &position }
}
pub fn as_external_error(&self, error: impl std::error::Error) -> Error<'a> {
Error::new_from_external(self.position, error)
}
}
impl<'a> From<Span<'a>> for Token<'a> {