chiark / gitweb /
errors: Abolish Fatal::Occultation
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 13 Jul 2021 14:21:52 +0000 (15:21 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 13 Jul 2021 14:21:52 +0000 (15:21 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
daemon/api.rs
src/error.rs
src/hidden.rs

index bb6053d15376eaac75113c0a8f194428932a25d0..35720a55da7fa1166becbc20a5464333641576bc 100644 (file)
@@ -77,7 +77,7 @@ impl From<&FatalErrorResponse> for rocket::http::Status {
       NoClient | NoPlayer(_) | GameBeingDestroyed(_)
         => Status::NotFound,
       OE::PieceHeld | OE::PieceImmoveable |
-      OE::OverlappingOccultation | OE::Occultation |
+      OE::OverlappingOccultation |
       BadOperation | BadJSON(_)
         => Status::BadRequest,
     }
@@ -448,7 +448,7 @@ api_route!{
     let ApiPieceOpArgs { gs,piece, .. } = a;
     let gpc = gs.pieces.byid_mut(piece).unwrap();
     if gpc.occult.is_active() {
-      if self.z >= gpc.zlevel.z { throw!(OE::Occultation) }
+      if self.z >= gpc.zlevel.z { throw!(Ia::Occultation) }
     }
     gpc.zlevel = ZLevel { z: self.z.clone(), zg: gs.gen };
     let update = PieceUpdateOp::SetZLevel(());
index 3242a0c6d2112bfd1d40e925856f724911c7cfea..6c0b825110395cce90d377b2385e1ec28875ae75 100644 (file)
@@ -24,8 +24,6 @@ pub enum Fatal { // Includes _bogus_ client updates, see PROTOCOL.md
   BadOperation, // xxx should be _inapplicable_
   #[error("overlapping occultation")]
   OverlappingOccultation, // xxx should be _inapplicable_
-  #[error("piece is occulting, or occulted")]
-  Occultation, // xxx should be _inapplicable_
 }
 
 #[derive(Error,Debug)]
index f768fb0fae3cb30c96586acb4b6ea1c4f0d67435..3b9d45f51ff0ab8d296794629d624033241d6b05 100644 (file)
@@ -455,9 +455,9 @@ impl GPiece {
     self.occult.active.is_some()
   }
 
-  #[throws(OE)]
+  #[throws(Ia)]
   pub fn forbid_involved_in_occultation(&self) {
-    if self.involved_in_occultation() { throw!(OE::Occultation) }
+    if self.involved_in_occultation() { throw!(Ia::Occultation) }
   }
 }