Add 'FenError::InvalidPosition' variant

This commit is contained in:
Bruno BELANYI 2022-07-28 21:17:12 +02:00
parent c112ddc4cd
commit ddcef6f9c0

View file

@ -12,12 +12,15 @@ pub trait FromFen: Sized {
pub enum FenError {
/// Invalid FEN input.
InvalidFen,
/// Invalid chess position.
InvalidPosition,
}
impl std::fmt::Display for FenError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let error_msg = match self {
Self::InvalidFen => "Invalid FEN input",
Self::InvalidPosition => "Invalid chess position",
};
write!(f, "{}", error_msg)
}