1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
use std;
use std::fmt;
#[derive(Debug)]
pub enum Error {
Read(String),
Write(String),
Other(String),
}
impl fmt::Display for Error {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
write!(fmt, "{:?}", self)
}
}
impl std::error::Error for Error {
fn description(&self) -> &str {
match *self {
Error::Read(_) => "postgis error while reading",
Error::Write(_) => "postgis error while writing",
Error::Other(_) => "postgis unknown error",
}
}
}