Skip to main content

neo_decompiler/error/
manifest.rs

1use std::io;
2use std::str::Utf8Error;
3
4use thiserror::Error;
5
6/// Errors returned while parsing Neo manifest files.
7#[derive(Debug, Error)]
8#[non_exhaustive]
9pub enum ManifestError {
10    /// Failed to read the manifest file contents.
11    #[error("failed to read manifest: {0}")]
12    Io(#[from] io::Error),
13
14    /// Manifest content exceeded the configured maximum size.
15    #[error("manifest size {size} exceeds maximum {max}")]
16    FileTooLarge {
17        /// Manifest size in bytes.
18        size: u64,
19        /// Maximum allowed size in bytes.
20        max: u64,
21    },
22
23    /// The manifest JSON failed to parse.
24    #[error("manifest json parse error: {0}")]
25    Json(#[from] serde_json::Error),
26
27    /// The manifest bytes were not valid UTF-8.
28    #[error("manifest contains invalid utf-8: {source}")]
29    InvalidUtf8 {
30        /// Original UTF-8 decoding error.
31        #[source]
32        source: Utf8Error,
33    },
34
35    /// The manifest passed JSON parsing but failed strict semantic validation.
36    #[error("manifest validation error: {message}")]
37    Validation {
38        /// Human-readable validation failure details.
39        message: String,
40    },
41}