From a40451c33656e9947ccf173830d28e70a808efd3 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Fri, 26 Feb 2021 00:34:11 +0000 Subject: [PATCH] apitest: Introduce own ExitStatusError (for now) Signed-off-by: Ian Jackson --- apitest.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apitest.rs b/apitest.rs index b62c96c6..b86c7776 100644 --- a/apitest.rs +++ b/apitest.rs @@ -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>(()) })() -- 2.30.2