chiark / gitweb /
errors: Provide custom Display impls for Inapplicable errors
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 13 Jul 2021 14:13:36 +0000 (15:13 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 13 Jul 2021 14:13:36 +0000 (15:13 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
src/error.rs

index 7b4c4cd75fdb37c0b5350b59b8e5ac388bf92ea8..8387515dd9eb3173c0146bf1a25ff69be49aa178 100644 (file)
@@ -175,15 +175,14 @@ display_as_debug!{PieceOpErrorPartiallyProcessed}
 
 #[derive(Error,Debug,Serialize,Copy,Clone)]
 pub enum Inapplicable {
-  Conflict,
-  PosOffTable,
-  PieceGone,
-  Occultation,
-  PieceUnrotateable,
-  OcculterAlreadyRotated,
-  OrganisedPlacementOverfull,
+  #[error("simultaneous update")]         Conflict,
+  #[error("position off table")]          PosOffTable,
+  #[error("piece gone")]                  PieceGone,
+  #[error("prevented by occultation")]    Occultation,
+  #[error("piece may not be rotated")]    PieceUnrotateable,
+  #[error("occulter already rotated")]    OcculterAlreadyRotated,
+  #[error("overfull, cannot organise")]   OrganisedPlacementOverfull,
 }
-display_as_debug!{Inapplicable}
 
 pub type StartupError = anyhow::Error;