Use lower-case in error messages

This commit is contained in:
Bruno BELANYI 2024-04-06 11:17:45 +01:00
parent 7c4f5317b0
commit 5dce65c570
2 changed files with 14 additions and 14 deletions

View file

@ -30,24 +30,24 @@ pub enum ValidationError {
impl std::fmt::Display for ValidationError { impl std::fmt::Display for ValidationError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let error_msg = match self { let error_msg = match self {
Self::TooManyPieces => "Too many pieces", Self::TooManyPieces => "too many pieces",
Self::MissingKing => "Missing king", Self::MissingKing => "missing king",
Self::InvalidPawnPosition => "Pawns on the first/last rank", Self::InvalidPawnPosition => "pawns on the first/last rank",
Self::InvalidCastlingRights => { Self::InvalidCastlingRights => {
"Castling rights do not match up with the state of the board" "castling rights do not match up with the state of the board"
} }
Self::InvalidEnPassant => { Self::InvalidEnPassant => {
"En-passant target square is not empty, behind an opponent's pawn, on the correct rank" "en-passant target square is not empty, behind an opponent's pawn, on the correct rank"
} }
Self::NeighbouringKings => "The two kings are next to each other", Self::NeighbouringKings => "the two kings are next to each other",
Self::OpponentInCheck => "The opponent is currently in check", Self::OpponentInCheck => "the opponent is currently in check",
Self::OverlappingPieces => "The piece-specific boards are overlapping", Self::OverlappingPieces => "the piece-specific boards are overlapping",
Self::OverlappingColors => "The color-specific boards are overlapping", Self::OverlappingColors => "the color-specific boards are overlapping",
Self::ErroneousCombinedOccupancy => { Self::ErroneousCombinedOccupancy => {
"The pre-computed combined occupancy boards does not match the other boards" "the pre-computed combined occupancy boards does not match the other boards"
} }
Self::HalfMoveClockTooHigh => "Half-move clock is higher than total number of plies", Self::HalfMoveClockTooHigh => "half-move clock is higher than total number of plies",
Self::IncoherentPlieCount => "The total plie count does not match the current player", Self::IncoherentPlieCount => "the total plie count does not match the current player",
}; };
write!(f, "{}", error_msg) write!(f, "{}", error_msg)
} }

View file

@ -21,8 +21,8 @@ pub enum FenError {
impl std::fmt::Display for FenError { impl std::fmt::Display for FenError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self { match self {
Self::InvalidFen => write!(f, "Invalid FEN input"), Self::InvalidFen => write!(f, "invalid FEN input"),
Self::InvalidPosition(err) => write!(f, "Invalid chess position: {}", err), Self::InvalidPosition(err) => write!(f, "invalid chess position: {}", err),
} }
} }
} }