noir_artifact_cli/
errors.rs1use acir::FieldElement;
2use nargo::{NargoError, foreign_calls::transcript::TranscriptError};
3use noirc_abi::{
4 AbiReturnType,
5 errors::{AbiError, InputParserError},
6 input_parser::InputValue,
7};
8use std::path::PathBuf;
9use thiserror::Error;
10
11#[derive(Debug, Error)]
12pub enum FilesystemError {
13 #[error("Cannot find input file '{0}'")]
14 MissingInputFile(PathBuf),
15
16 #[error("Failed to create output file '{0}': {1}")]
17 OutputFileCreationFailed(PathBuf, String),
18
19 #[error("Failed to parse input file '{0}': {1}")]
20 InvalidInputFile(PathBuf, String),
21
22 #[error("Cannot find bytecode file '{0}'")]
23 MissingBytecodeFile(PathBuf),
24
25 #[error("Failed to read bytecode file '{0}': {1}")]
26 InvalidBytecodeFile(PathBuf, String),
27
28 #[error("Failed to create output witness file '{0}': {1}")]
29 OutputWitnessCreationFailed(PathBuf, String),
30
31 #[error(transparent)]
32 IoError(#[from] std::io::Error),
33}
34
35#[derive(Debug, Error)]
36pub enum CliError {
37 #[error(transparent)]
39 FilesystemError(#[from] FilesystemError),
40
41 #[error("Failed to deserialize inputs")]
43 InputDeserializationError(#[from] InputParserError),
44
45 #[error(transparent)]
47 TranscriptError(#[from] TranscriptError),
48
49 #[error(transparent)]
51 AbiError(#[from] AbiError),
52
53 #[error("Failed to deserialize artifact from JSON")]
55 ArtifactDeserializationError(#[from] serde_json::Error),
56
57 #[error("Failed to deserialize circuit from bytecode")]
59 CircuitDeserializationError(#[from] std::io::Error),
60
61 #[error(transparent)]
63 CircuitExecutionError(#[from] NargoError<FieldElement>),
64
65 #[error("Failed to parse witness value {0}")]
67 WitnessValueError(String),
68
69 #[error("Failed to parse witness index {0}")]
71 WitnessIndexError(String),
72
73 #[error("Failed to serialize output witness: {0}")]
74 OutputWitnessSerializationFailed(#[from] toml::ser::Error),
75
76 #[error("Unexpected return value: expected {expected:?}; got {actual:?}")]
77 UnexpectedReturn { expected: InputValue, actual: Option<InputValue> },
78
79 #[error("Missing return witnesses; expected {expected:?}")]
80 MissingReturn { expected: AbiReturnType },
81
82 #[error("Missing contract function name; options: {names:?}")]
83 MissingContractFn { names: Vec<String> },
84
85 #[error("Unknown contract function '{name}'; options: {names:?}")]
86 UnknownContractFn { name: String, names: Vec<String> },
87}