check_buddy_core/
errors.rs1#![allow(unused)]
2
3use crate::position_move::Position;
4use crate::Piece;
5use thiserror::Error;
6
7#[derive(Error, Debug)]
8pub enum PieceError {
9 #[error("Can't find piece type from symbol")]
10 SymbolNotFound,
11}
12
13#[derive(Error, Debug)]
14pub enum PieceMoveError {
15 #[error("You're trying to do an illegal move")]
16 IllegalMove,
17 #[error("Piece you're taking is not valid")]
18 InvalidTakePiece,
19 #[error("You're trying to move a piece that's empty")]
20 EmptySquare,
21 #[error("{0:?} on {1:?} is not yours")]
22 NotYourPiece(Piece, Position),
23 #[error("Move not found")]
24 MoveNotFound,
25}
26
27#[derive(Error, Debug)]
28pub enum UciMoveError {
29 #[error("Couldn't convert string to digit: {0:}")]
30 DigitParseFailed(String),
31 #[error("Can't parse uci move")]
32 InvalidUciMove,
33 #[error("Can't parse uci move type")]
34 InvalidUciMoveType,
35 #[error("Couldn't find [from] position")]
36 FromNotFound,
37 #[error("Couldn't find [to] position")]
38 ToNotFound,
39}