From: Ian Jackson Date: Fri, 26 Feb 2021 00:34:11 +0000 (+0000) Subject: apitest: Introduce own ExitStatusError (for now) X-Git-Tag: otter-0.4.0~360 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=a40451c33656e9947ccf173830d28e70a808efd3;p=otter.git apitest: Introduce own ExitStatusError (for now) Signed-off-by: Ian Jackson --- 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>(()) })()