1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
use thiserror::Error;
use crate::{Board, ChessMove};
#[derive(Error, Clone, PartialEq, Eq, Debug)]
pub enum Error {
#[error(
"Invalid move ({}) on the given board ({}) according to the chess rule",
invalid_move,
board
)]
InvalidMove {
board: Board,
invalid_move: ChessMove,
},
#[error("Invalid FEN string: {}", fen)]
InvalidFen { fen: String },
#[error("The string specified does not contain a valid SAN notation move")]
InvalidSanMove,
#[error("The string specified does not contain a valid algebraic notation square")]
InvalidSquare,
#[error("The string specified does not contain a valid rank")]
InvalidRank,
#[error("The string specified does not contain a valid file")]
InvalidFile,
}