nexus_sdk/error.rs
1use thiserror::Error;
2
3/// Errors that occur when configuring or using a given prover.
4#[derive(Debug, Error)]
5pub enum ConfigurationError {
6 /// A configuration operation is not applicable for a given prover.
7 #[error("operation does not apply for configured prover")]
8 NotApplicableOperation,
9
10 /// The prover or verifier was invoked without yet having been configured.
11 #[error("operation invoked without required configuration having been done")]
12 NotYetConfigured,
13}
14
15/// Errors that occur during dynamic compilation of guest programs.
16#[derive(Debug, Error)]
17pub enum BuildError {
18 /// The compile options are invalid for the memory limit (only relevant for [`legacy`](crate::legacy) provers).
19 #[error("invalid memory configuration for selected prover")]
20 InvalidMemoryConfiguration,
21
22 /// An error occurred reading or writing to the file system.
23 #[error(transparent)]
24 IOError(#[from] std::io::Error),
25
26 /// The compilation process failed.
27 #[error("unable to compile using the configured compiler (e.g., rustc via Cargo)")]
28 CompilerError,
29}
30
31/// Errors that occur while reading from or writing to the input/output segments and tapes of the zkVM.
32#[derive(Debug, Error)]
33pub enum IOError {
34 /// Error serializing to or deserializing from the zkVM input/output segments and tapes.
35 #[error("serialization error: {0}")]
36 SerializationError(#[from] postcard::Error),
37
38 /// Error accessing not yet available input/output entries from a [`CheckedView`](crate::traits::CheckedView).
39 #[error("Unable to access input/output information: did you forget to execute the zkVM?")]
40 NotYetAvailableError,
41
42 /// Error parsing the logging tape due to an encoding issue.
43 #[error("encoding error: {0}")]
44 EncodingError(#[from] std::string::FromUtf8Error),
45}
46
47/// Errors that occur while manipulating host system file paths.
48#[derive(Debug, Error)]
49pub enum PathError {
50 /// Invalid encoding used for path.
51 #[error("provided path has invalid encoding for use with filesystem")]
52 EncodingError,
53}