1use std::error::Error;
2use std::fmt;
3
4#[derive(Debug)]
5pub struct InvalidSizeError {
6 pub var_name: String,
7}
8
9
10impl fmt::Display for InvalidSizeError {
11 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
12 write!(f, "Invalid size of '{}'", self.var_name)
13 }
14}
15impl Error for InvalidSizeError {
16 fn description(&self) -> &str {
17 "An numeric value of an invalid size has been passed."
18 }
19}
20
21
22#[derive(Debug)]
23pub struct InconsistentFormatError;
24
25impl fmt::Display for InconsistentFormatError {
26 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
27 write!(
28 f,
29 "Color formats of background and foreground must be consistent."
30 )
31 }
32}
33impl Error for InconsistentFormatError {
34 fn description(&self) -> &str {
35 "Color formats of background and foreground must be consistent."
36 }
37}