table/
error.rs

1// Copyright (C) 2018  Project Tsukurou!
2//
3// This program is free software: you can redistribute it and/or modify
4// it under the terms of the GNU General Public License as published by
5// the Free Software Foundation, either version 3 of the License, or
6// (at your option) any later version.
7//
8// This program is distributed in the hope that it will be useful,
9// but WITHOUT ANY WARRANTY; without even the implied warranty of
10// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11// GNU General Public License for more details.
12//
13// You should have received a copy of the GNU General Public License
14// along with this program.  If not, see <https://www.gnu.org/licenses/>.
15
16use std::error;
17use std::fmt;
18
19/// The crate's common error type.
20#[derive(Clone, PartialEq, Eq)]
21pub struct Error {
22    pub(crate) message: String,
23}
24
25impl fmt::Display for Error {
26    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
27        f.write_str(&self.message)
28    }
29}
30
31impl fmt::Debug for Error {
32    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
33        fmt::Display::fmt(self, f)
34    }
35}
36
37impl error::Error for Error {}