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