postgis_butmaintained/
error.rs

1//  FileName    : error.rs
2//  Author      : ShuYu Wang <andelf@gmail.com>
3//  Created     : Wed May 27 01:45:41 2015 by ShuYu Wang
4//  Copyright   : Feather Workshop (c) 2015
5//  Description : PostGIS helper
6//  Time-stamp: <2015-06-13 19:21:08 andelf>
7
8use std;
9use std::fmt;
10
11#[derive(Debug)]
12pub enum Error {
13    Read(String),
14    Write(String),
15    Other(String),
16}
17
18impl fmt::Display for Error {
19    fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
20        write!(fmt, "{:?}", self)
21    }
22}
23
24impl std::error::Error for Error {
25    fn description(&self) -> &str {
26        match *self {
27            Error::Read(_) => "postgis error while reading",
28            Error::Write(_) => "postgis error while writing",
29            Error::Other(_) => "postgis unknown error",
30        }
31    }
32}