Skip to main content

chess/
error.rs

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