1use openvm_circuit::arch::{VirtualMachineError, VmVerificationError};
2use openvm_transpiler::transpiler::TranspilerError;
3use openvm_verify_stark_host::error::VerifyStarkError;
4use thiserror::Error;
5
6use crate::SC;
7
8#[derive(Error, Debug)]
9pub enum SdkError {
10 #[error("I/O error: {0}")]
11 Io(#[from] std::io::Error),
12 #[error("Failed to build guest: code = {0}")]
13 BuildFailedWithCode(i32),
14 #[error("Failed to build guest (OPENVM_SKIP_BUILD is set)")]
15 BuildFailed,
16 #[error("SDK must set a transpiler")]
17 TranspilerNotAvailable,
18 #[error("Transpiler error: {0}")]
19 Transpiler(#[from] TranspilerError),
20 #[error("VM error: {0}")]
21 Vm(#[from] VirtualMachineError),
22 #[error("STARK verification failed with error: {0}")]
23 VerifyStark(#[from] VerifyStarkError),
24 #[error("Other error: {0}")]
25 Other(#[from] eyre::Error),
26}
27
28impl From<VmVerificationError<SC>> for SdkError {
29 fn from(error: VmVerificationError<SC>) -> Self {
30 SdkError::Other(error.into())
31 }
32}