Skip to content

Commit

Permalink
chore(nargo): create a specific error variant for compilation (#923)
Browse files Browse the repository at this point in the history
chore(nargo): create a specifc error variant for compilation
  • Loading branch information
TomAFrench authored Feb 28, 2023
1 parent e87ce66 commit 4a0145f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion crates/nargo/src/cli/compile_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ pub(crate) fn compile_circuit<P: AsRef<Path>>(
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<P: AsRef<Path>>(
Expand Down
4 changes: 4 additions & 0 deletions crates/nargo/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<OpcodeResolutionError> for CliError {
Expand Down

0 comments on commit 4a0145f

Please sign in to comment.