diff --git a/Cargo.toml b/Cargo.toml index cadd750..d476879 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,7 +16,7 @@ documentation = "https://jordanbray.github.io/chess/chess/index.html" [dependencies] arrayvec = "0.5.1" nodrop = "0.1.14" -failure = "0.1.6" +thiserror = "2.0.12" tracing = { version = "0.1.37", optional = true } [features] @@ -46,7 +46,7 @@ opt-level = 3 [build-dependencies] rand = { version = "0.7.2", default_features = false, features = ["small_rng"] } -failure = "0.1.6" +thiserror = "2.0.12" [dev-dependencies] criterion = "0.3" diff --git a/src/error.rs b/src/error.rs index 185b83a..4a88c93 100644 --- a/src/error.rs +++ b/src/error.rs @@ -1,35 +1,35 @@ -use failure::Fail; +use thiserror::Error; /// Sometimes, bad stuff happens. -#[derive(Clone, Debug, Fail)] +#[derive(Clone, Debug, Error)] pub enum Error { /// The FEN string is invalid - #[fail(display = "Invalid FEN string: {}", fen)] + #[error("Invalid FEN string: {fen}")] InvalidFen { fen: String }, /// The board created from BoardBuilder was found to be invalid - #[fail( - display = "The board specified did not pass sanity checks. Are you sure the kings exist and the side to move cannot capture the opposing king?" + #[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?" )] InvalidBoard, /// An attempt was made to create a square from an invalid string - #[fail(display = "The string specified does not contain a valid algebraic notation square")] + #[error("The string specified does not contain a valid algebraic notation square")] InvalidSquare, /// An attempt was made to create a move from an invalid SAN string - #[fail(display = "The string specified does not contain a valid SAN notation move")] + #[error("The string specified does not contain a valid SAN notation move")] InvalidSanMove, /// An atempt was made to create a move from an invalid UCI string - #[fail(display = "The string specified does not contain a valid UCI notation move")] + #[error("The string specified does not contain a valid UCI notation move")] InvalidUciMove, /// An attempt was made to convert a string not equal to "1"-"8" to a rank - #[fail(display = "The string specified does not contain a valid rank")] + #[error("The string specified does not contain a valid rank")] InvalidRank, /// An attempt was made to convert a string not equal to "a"-"h" to a file - #[fail(display = "The string specified does not contain a valid file")] + #[error("The string specified does not contain a valid file")] InvalidFile, }