Skip to main content

smplx_sdk/program/
error.rs

1#[derive(Debug, thiserror::Error)]
2pub enum ProgramError {
3    #[error("Failed to compile Simplicity program: {0}")]
4    Compilation(String),
5
6    #[error("Failed to satisfy witness: {0}")]
7    WitnessSatisfaction(String),
8
9    #[error("Failed to prune program: {0}")]
10    Pruning(#[from] simplicityhl::simplicity::bit_machine::ExecutionError),
11
12    #[error("Failed to construct a Bit Machine with enough space: {0}")]
13    BitMachineCreation(#[from] simplicityhl::simplicity::bit_machine::LimitError),
14
15    #[error("Failed to execute program on the Bit Machine: {0}")]
16    Execution(simplicityhl::simplicity::bit_machine::ExecutionError),
17
18    #[error("UTXO index {input_index} out of bounds (have {utxo_count} UTXOs)")]
19    UtxoIndexOutOfBounds { input_index: usize, utxo_count: usize },
20
21    #[error("Script pubkey mismatch: expected hash {expected_hash}, got {actual_hash}")]
22    ScriptPubkeyMismatch { expected_hash: String, actual_hash: String },
23
24    #[error("Failed to extract tx from pst: {0}")]
25    TxExtraction(#[from] simplicityhl::elements::pset::Error),
26
27    #[error("Input index exceeds u32 maximum: {0}")]
28    InputIndexOverflow(#[from] std::num::TryFromIntError),
29}