neo_decompiler/error.rs
1//! Error types returned by the library.
2//!
3//! Most public APIs return [`crate::Result`], which uses [`enum@Error`] as the error
4//! type. The variants provide access to more specific error categories when
5//! needed.
6
7mod disassembly;
8mod manifest;
9mod nef;
10
11use std::io;
12
13use thiserror::Error;
14
15pub use disassembly::DisassemblyError;
16pub use manifest::ManifestError;
17pub use nef::NefError;
18
19/// Convenient result alias for the library.
20pub type Result<T> = std::result::Result<T, Error>;
21
22/// Top level error surfaced by the library APIs.
23#[derive(Debug, Error)]
24#[non_exhaustive]
25pub enum Error {
26 /// Errors encountered while parsing a NEF container.
27 #[error(transparent)]
28 Nef(#[from] NefError),
29
30 /// Errors encountered while decoding Neo VM bytecode.
31 #[error(transparent)]
32 Disassembly(#[from] DisassemblyError),
33
34 /// I/O failures when reading inputs.
35 #[error(transparent)]
36 Io(#[from] io::Error),
37
38 /// Errors encountered while parsing a contract manifest.
39 #[error(transparent)]
40 Manifest(#[from] ManifestError),
41}