1use acvm::FieldElement;
2use nargo::{NargoError, errors::CompileError};
3use nargo_toml::ManifestError;
4use noir_debugger::errors::DapError;
5use noirc_abi::errors::AbiError;
6use std::path::PathBuf;
7use thiserror::Error;
8
9#[derive(Debug, Error)]
10pub enum CliError {
11 #[error("{0}")]
12 Generic(String),
13
14 #[error("Error: destination {} already exists\n\nUse `new init` to initialize the directory", .0.display())]
15 DestinationAlreadyExists(PathBuf),
16
17 #[error("Error: --program-directory '{}' does not exist", .0.display())]
18 ProgramDirDoesNotExist(PathBuf),
19
20 #[error("Error: --program-directory '{}' is not a directory", .0.display())]
21 ProgramDirIsNotADirectory(PathBuf),
22
23 #[error(
24 "Error: `nargo init` cannot be run on existing packages.\nNote: `Nargo.toml` already exists."
25 )]
26 NargoInitCannotBeRunOnExistingPackages,
27
28 #[error(
29 "Error: {0}\nIf you need a package name to not match the directory name, consider using the `--name` flag."
30 )]
31 InvalidPackageName(String),
32
33 #[error("`--debug-compile-stdin` is incompatible with `--watch`")]
34 CantWatchStdin,
35
36 #[error(transparent)]
38 ArtifactError(#[from] noir_artifact_cli::errors::CliError),
39
40 #[error(transparent)]
42 AbiError(#[from] AbiError),
43
44 #[error(transparent)]
45 LspError(#[from] async_lsp::Error),
46
47 #[error(transparent)]
48 DapError(#[from] DapError),
49
50 #[error(transparent)]
52 NargoError(#[from] NargoError<FieldElement>),
53
54 #[error(transparent)]
56 ManifestError(#[from] ManifestError),
57
58 #[error(transparent)]
60 CompileError(#[from] CompileError),
61}