clockwork_cron/
error.rs

1use std::{error, fmt};
2
3#[derive(Debug)]
4pub struct Error {
5    kind: ErrorKind,
6}
7
8#[derive(Debug)]
9pub enum ErrorKind {
10    Expression(String),
11}
12
13impl fmt::Display for Error {
14    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
15        match self.kind {
16            ErrorKind::Expression(ref expr) => write!(f, "Invalid expression: {}", expr),
17        }
18    }
19}
20
21impl error::Error for Error {}
22
23impl From<ErrorKind> for Error {
24    fn from(kind: ErrorKind) -> Error {
25        Error { kind }
26    }
27}