lioness/
error.rs

1// Copyright 2016 Jeffrey Burdges and David Stainton
2
3//! Error reporting for Lioness wide block cipher.
4
5use std::error::Error;
6use std::fmt;
7
8
9#[derive(Debug)]
10pub enum LionessError {
11    BlockSizeError,
12}
13
14impl fmt::Display for LionessError {
15    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
16        use self::LionessError::*;
17        match *self {
18            BlockSizeError => write!(f, "Lioness block size must exceed 32 bytes."),
19        }
20    }
21}
22
23
24impl Error for LionessError {
25    fn description(&self) -> &str {
26        "I'm a Lioness error."
27    }
28
29    fn cause(&self) -> Option<&Error> {
30        use self::LionessError::*;
31        match *self {
32            BlockSizeError => None,
33        }
34    }
35}
36
37
38