chess/
error.rs

1use failure::Fail;
2
3/// Sometimes, bad stuff happens.
4#[derive(Clone, Debug, Fail)]
5pub enum Error {
6    /// The FEN string is invalid
7    #[fail(display = "Invalid FEN string: {}", fen)]
8    InvalidFen { fen: String },
9
10    /// The board created from BoardBuilder was found to be invalid
11    #[fail(
12        display = "The board specified did not pass sanity checks.  Are you sure the kings exist and the side to move cannot capture the opposing king?"
13    )]
14    InvalidBoard,
15
16    /// An attempt was made to create a square from an invalid string
17    #[fail(display = "The string specified does not contain a valid algebraic notation square")]
18    InvalidSquare,
19
20    /// An attempt was made to create a move from an invalid SAN string
21    #[fail(display = "The string specified does not contain a valid SAN notation move")]
22    InvalidSanMove,
23
24    /// An atempt was made to create a move from an invalid UCI string
25    #[fail(display = "The string specified does not contain a valid UCI notation move")]
26    InvalidUciMove,
27
28    /// An attempt was made to convert a string not equal to "1"-"8" to a rank
29    #[fail(display = "The string specified does not contain a valid rank")]
30    InvalidRank,
31
32    /// An attempt was made to convert a string not equal to "a"-"h" to a file
33    #[fail(display = "The string specified does not contain a valid file")]
34    InvalidFile,
35}