chiark / gitweb /
apitest: Introduce own ExitStatusError (for now)
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 26 Feb 2021 00:34:11 +0000 (00:34 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 26 Feb 2021 00:36:07 +0000 (00:36 +0000)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
apitest.rs

index b62c96c626207dacc4e6cb28c2304c82eba4e86b..b86c77766bfd80b858eb890b67e959734928b8af 100644 (file)
@@ -29,6 +29,7 @@ pub use serde::{Serialize, Deserialize};
 pub use serde_json::json;
 pub use structopt::StructOpt;
 pub use strum::{EnumIter, EnumProperty, IntoEnumIterator, IntoStaticStr};
+pub use thiserror::Error;
 pub use void::Void;
 
 pub use std::env;
@@ -653,6 +654,10 @@ _ = "error" # rocket
 
 // ---------- game spec ----------
 
+#[derive(Copy,Clone,Error,Debug)]
+#[error("wait status: {0}")]
+struct ExitStatusError(pub std::process::ExitStatus);
+
 impl DirSubst {
   pub fn specs_dir(&self) -> String {
     format!("{}/specs" , &self.src)
@@ -674,7 +679,7 @@ impl DirSubst {
         .spawn().context("spawn")?
         .wait().context("wait")?;
       if !st.success() {
-        throw!(anyhow!("wait status {}", &st));
+        throw!(ExitStatusError(st));
       }
       Ok::<_,AE>(())
     })()