Add 'Error::InvalidPosition' variant

This commit is contained in:
Bruno BELANYI 2022-07-28 21:17:12 +02:00
parent 76577718d8
commit 08ff8db0ac

View file

@ -2,12 +2,14 @@
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
pub enum Error {
InvalidFen,
InvalidPosition,
}
impl std::fmt::Display for Error {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let error_msg = match self {
Self::InvalidFen => "Invalid FEN input",
Self::InvalidPosition => "Invalid position",
};
write!(f, "{}", error_msg)
}