Skip to main content

Error

Enum Error 

Source
pub enum Error {
Show 15 variants Goblin(String), Not32Bit { magic: u16, }, TooShort { expected: usize, actual: usize, context: &'static str, }, OverlayNotFound, SignatureNotFound, InvalidFirstHeaderFlags { flags: u32, }, DecompressionFailed { method: &'static str, detail: String, }, UnsupportedCompression, OutputTooLarge { limit: usize, }, InvalidBlockOffset { block: &'static str, offset: u32, }, InvalidMagic { expected: u32, got: u32, }, InvalidBlockIndex { index: usize, }, InvalidStringOffset { offset: u32, }, InvalidSpecialCode { code: u8, }, InvalidOpcode { which: u32, },
}
Expand description

All errors that can occur during NSIS installer parsing.

Each variant carries enough context for a useful diagnostic message. The enum is intentionally flat (not hierarchical) to keep the API surface simple.

Variants§

§

Goblin(String)

The underlying PE parser (goblin) failed.

The inner string contains the stringified goblin error. We stringify because goblin::error::Error does not implement Clone/Eq.

§

Not32Bit

The PE optional header magic is not 0x010B (PE32).

NSIS installers are always 32-bit PE executables.

Fields

§magic: u16

The actual optional header magic value encountered.

§

TooShort

A buffer or structure is too short.

The parser expected at least expected bytes but found only actual.

Fields

§expected: usize

Minimum bytes required.

§actual: usize

Actual bytes available.

§context: &'static str

Human-readable name of the structure being parsed.

§

OverlayNotFound

No PE overlay was found after the last section.

NSIS data is appended as a PE overlay; a file with no overlay cannot be an NSIS installer.

§

SignatureNotFound

No valid NSIS FirstHeader signature was found in the overlay.

The scanner checked 512-byte aligned offsets first and then non-aligned fallback offsets for a structurally usable 0xDEADBEEF + "NullsoftInst" magic sequence.

§

InvalidFirstHeaderFlags

The FirstHeader flags field contains invalid bits.

Fields

§flags: u32

The raw flags value that failed validation.

§

DecompressionFailed

Decompression of an NSIS data block failed.

Fields

§method: &'static str

The compression method that was attempted (e.g., "deflate").

§detail: String

A description of the failure.

§

UnsupportedCompression

None of the supported compression methods could decompress the data.

§

OutputTooLarge

Decompression produced more output than the configured budget allows.

Raised when a stream of unknown decompressed size (per-file, solid, or uninstaller data) expands past the caller’s max_decompressed_size budget. This guards against decompression bombs; the offending stream is rejected rather than silently truncated.

Fields

§limit: usize

The byte budget that was exceeded.

§

InvalidBlockOffset

A block header references an offset beyond the decompressed data.

Fields

§block: &'static str

Name of the block (e.g., "Sections").

§offset: u32

The invalid offset value.

§

InvalidMagic

A magic value did not match the expected constant.

Fields

§expected: u32

The expected magic value.

§got: u32

The actual value found.

§

InvalidBlockIndex

A block index is out of the valid range (0..8).

Fields

§index: usize

The invalid block index.

§

InvalidStringOffset

A string table offset is out of range.

Fields

§offset: u32

The offset that was out of bounds.

§

InvalidSpecialCode

An unrecognized special code was encountered in the string table.

Fields

§code: u8

The code byte value.

§

InvalidOpcode

An entry’s which field does not map to a known opcode.

Fields

§which: u32

The raw opcode value.

Trait Implementations§

Source§

impl Clone for Error

Source§

fn clone(&self) -> Error

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Error

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for Error

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Error

Source§

impl Error for Error

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<Error> for Error

Source§

fn from(e: Error) -> Self

Converts a goblin parsing error into our Error::Goblin variant.

Source§

impl PartialEq for Error

Source§

fn eq(&self, other: &Error) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for Error

Auto Trait Implementations§

§

impl Freeze for Error

§

impl RefUnwindSafe for Error

§

impl Send for Error

§

impl Sync for Error

§

impl Unpin for Error

§

impl UnsafeUnpin for Error

§

impl UnwindSafe for Error

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.