chiark / gitweb /
errors: Make Ia::BadUiOperation
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 13 Jul 2021 14:26:20 +0000 (15:26 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 13 Jul 2021 14:26:20 +0000 (15:26 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
daemon/api.rs
src/deck.rs
src/error.rs
src/gamestate.rs
src/hand.rs

index c35f1d6f0526a14e144228bc3f182ad2b92743fa..3fc6c3481269cc32b4ba3a6ba49d4231fa538472 100644 (file)
@@ -77,7 +77,7 @@ impl From<&FatalErrorResponse> for rocket::http::Status {
       NoClient | NoPlayer(_) | GameBeingDestroyed(_)
         => Status::NotFound,
       OE::PieceHeld | OE::PieceImmoveable |
-      BadOperation | BadJSON(_)
+      BadJSON(_)
         => Status::BadRequest,
     }
   }
index c47f53e3357d08ed3f71973a827b522f19ec801b..48bbcbed6c71c1e74053a6b933abd5573e4c8ef7 100644 (file)
@@ -186,7 +186,7 @@ impl PieceTrait for Deck {
       "activate"   => (Enabled,  hformat!("enabled {}",         CORE_DESC)),
       "counting"   => (Counting, hformat!("set {} to counting", CORE_DESC)),
       "deactivate" => (Disabled, hformat!("disabled {}",        CORE_DESC)),
-      _ => throw!(OE::BadOperation),
+      _ => throw!(Ia::BadUiOperation),
     };
   
     let new_view = match new_state {
index f22d1d51247673cf3396f2a09055094facbafa0c..5f0d73d0e1caa44c4fd5135ab47a05ae3acb98ec 100644 (file)
@@ -20,8 +20,6 @@ pub enum Fatal { // Includes _bogus_ client updates, see PROTOCOL.md
   PieceHeld, // xxx should be _inapplicable_
   #[error("improper UI operation")]
   PieceImmoveable, // xxx should be _inapplicable_
-  #[error("improper UI operation")]
-  BadOperation, // xxx should be _inapplicable_
 }
 
 #[derive(Error,Debug)]
@@ -180,6 +178,7 @@ pub enum Inapplicable {
   #[error("occulter already rotated")]      OcculterAlreadyRotated,
   #[error("overfull, cannot organise")]     OrganisedPlacementOverfull,
   #[error("overlapping occultation(s)")]    OverlappingOccultation,
+  #[error("UI operation not recognised")]   BadUiOperation,
   #[error("UI operation not valid in the curret piece state")]
                                             BadPieceStateForOperation,
 }
index ef234c497a2f9db685383c0b52b97147e9501c8f..db930b2adff0eacf2dc155290f6b25578d76e8e1 100644 (file)
@@ -185,7 +185,7 @@ pub trait PieceTrait: OutlineTrait + Send + Debug + 'static {
   fn ui_operation(&self, _: ShowUnocculted, _a: ApiPieceOpArgs<'_>,
                   _opname: &str, _wrc: WhatResponseToClientOp)
                   -> Result<UpdateFromOpComplex, ApiPieceOpError> {
-    throw!(OE::BadOperation)
+    throw!(Ia::BadUiOperation)
   }
 
   // #[throws] doesn't work here - fehler #todo
index c7f1e70ccd88d59f3bf74475178f13415db15ce2..dd675fef4c1536740402840df8e98bee30460ea6 100644 (file)
@@ -316,7 +316,7 @@ impl PieceTrait for Hand {
         throw!(OE::PieceHeld);
       }
       _ => {
-        throw!(OE::BadOperation);
+        throw!(Ia::BadUiOperation);
       }
     };