From 4a0145f72b67f0dcafca8b1061387c58ee174efb Mon Sep 17 00:00:00 2001 From: Tom French <15848336+TomAFrench@users.noreply.github.com> Date: Tue, 28 Feb 2023 15:17:58 +0000 Subject: [PATCH] chore(nargo): create a specific error variant for compilation (#923) chore(nargo): create a specifc error variant for compilation --- crates/nargo/src/cli/compile_cmd.rs | 2 +- crates/nargo/src/errors.rs | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/nargo/src/cli/compile_cmd.rs b/crates/nargo/src/cli/compile_cmd.rs index 252e808926b..068451af451 100644 --- a/crates/nargo/src/cli/compile_cmd.rs +++ b/crates/nargo/src/cli/compile_cmd.rs @@ -59,7 +59,7 @@ pub(crate) fn compile_circuit>( let mut driver = Resolver::resolve_root_config(program_dir.as_ref(), backend.np_language())?; add_std_lib(&mut driver); - driver.into_compiled_program(show_ssa, allow_warnings).map_err(|_| std::process::exit(1)) + driver.into_compiled_program(show_ssa, allow_warnings).map_err(|_| CliError::CompilationError) } fn preprocess_with_path>( diff --git a/crates/nargo/src/errors.rs b/crates/nargo/src/errors.rs index e725fbb01d7..ab2f0b5eb89 100644 --- a/crates/nargo/src/errors.rs +++ b/crates/nargo/src/errors.rs @@ -22,6 +22,10 @@ pub(crate) enum CliError { MismatchedAcir(PathBuf), #[error("Failed to verify proof {}", .0.display())] InvalidProof(PathBuf), + + /// Error while compiling Noir into ACIR. + #[error("Failed to compile circuit")] + CompilationError, } impl From for CliError {