Skip to main content

Error

Enum Error 

Source
#[non_exhaustive]
pub enum Error {
Show 22 variants Detect(DetectError), OutOfBounds { what: &'static str, pos: i128, need: u64, have: u64, reader: ReaderKind, length: usize, }, Malformed { what: &'static str, detail: Arc<str>, }, WebSignature(RawStr), BundleSignature(RawStr), Unsupported(Unsupported), UnityCnKeyLength { length: usize, }, UnityCnKeyMissing, UnityCnVectorLength { length: usize, }, UnityCnSignature, Decompress { codec: Codec, detail: Arc<str>, }, Version(VersionError), TypeIndex { index: i32, len: usize, }, Tree(TreeError), AssetBundle(Arc<ParseError>), Entry { name: RawStr, source: Arc<Error>, }, Limit(LimitError), Budget(BudgetExceeded), Allocator(AllocError), NotFound(NotFound), Deref(Arc<DerefError>), Io(IoError),
}
Expand description

Why loading a file failed. Never a panic.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Detect(DetectError)

check_file_type raised (the dump’s "detect").

§

OutOfBounds

A read past the end where UnityPy raises too (struct.error, EOFError).

Fields

§what: &'static str

What was being read.

§pos: i128

The reader’s position at the read: a Python position, which may be negative or past the end (crate::stream::Reader::position).

§need: u64

Bytes needed.

§have: u64

Bytes left.

§reader: ReaderKind

Rules of the reader whose read failed.

§length: usize

Size of that reader’s buffer, including after decompression.

§

Malformed

Input UnityPy rejects with an exception other than a short read.

Fields

§what: &'static str

What was being read.

§detail: Arc<str>

The detail, for people. Shared, so a clone allocates nothing.

§

WebSignature(RawStr)

The decoded signature rejected by the WebFile constructor. Keep only a charged copy, so an error cannot retain an entire inflated input.

§

BundleSignature(RawStr)

The rejected bundle signature, copied into charged storage so nested failures identify their own input without retaining its whole buffer.

§

Unsupported(Unsupported)

A format or feature unityrs does not read (yet), each named.

§

UnityCnKeyLength

UnityPy’s key setter raises ValueError for this length.

Fields

§length: usize

Supplied length in bytes.

§

UnityCnKeyMissing

UnityPy raises LookupError after reading an encrypted header without a key.

§

UnityCnVectorLength

AES raises ValueError for a short header key vector.

Fields

§length: usize

Bytes read from the vector.

§

UnityCnSignature

UnityPy raises a plain Exception when the AES signature differs.

§

Decompress

A block failed to decode.

Fields

§codec: Codec

The block’s codec.

§detail: Arc<str>

The decoder’s message. Shared, so a clone allocates nothing.

§

Version(VersionError)

A version string did not parse, or no fallback was set.

§

TypeIndex

From format 16, an object’s type_id outside types (Python indexing: negative counts from the end; ObjectReader.py:98-101).

Fields

§index: i32

The object’s type_id.

§len: usize

How many types the file has.

§

Tree(TreeError)

A typetree’s rows could not be built into a tree, or the tree is over a limit.

§

AssetBundle(Arc<ParseError>)

The AssetBundle object read at load failed, which fails the file (SerializedFile.py:316-324; CANONICAL_DUMP.md section 7).

§

Entry

A bundle entry failed, which fails the bundle (File.py:76-90).

Fields

§name: RawStr

The entry’s directory path.

§source: Arc<Error>

Why it failed.

§

Limit(LimitError)

A bound from crate::limits::Limits was exceeded (the input’s meter included: LimitKind::InputMemory).

§

Budget(BudgetExceeded)

The memory budget refused a reservation, or the allocator failed.

§

Allocator(AllocError)

The host allocator refused storage; no heap-owned source is retained.

§

NotFound(NotFound)

A CAB, external, object or resource that is not there.

§

Deref(Arc<DerefError>)

A pointer that could not be followed where the caller raises it (the container preload, helpers/ContainerHelper.py:43-46, plan 3.13). A failure to load the target is that load’s own error, never this.

§

Io(IoError)

An I/O error from a source.

Implementations§

Source§

impl Error

Source

pub fn is_dependency_budget_refusal(&self) -> bool

Whether the dependency budget refused a reservation, including when an entry or object read wraps the refusal. A refusal carried inside a ParseError::Provider is not recognised here; callers that retry provider reads classify that case themselves.

Trait Implementations§

Source§

impl CellError for Error

Source§

fn is_transient(&self) -> bool

Whether the error depends on more than the input: a budget or meter refusal (crate::LimitKind::InputMemory), an I/O failure, a provider’s failure. Such an error is returned, never published.
Source§

fn is_meter_refusal(&self) -> bool

Whether the error is the input’s own meter refusing a charge (crate::LimitKind::InputMemory), and not the budget, I/O or a provider: what a computation that ends in it was granted counts as its open’s work (module docs).
Source§

fn heap_bytes(&self) -> u64

The heap the error owns (crate::limits::heap_cost of each Arc and string it holds, counted whether or not a string shares a file’s buffer), charged to the input’s meter while a cell keeps it. A clone shares that heap and allocates nothing.
Source§

fn work_refused(limit: LimitError) -> Self

The error for an ask refused because its open’s work has passed its allowance (limit is a crate::LimitKind::DecodeWork refusal): not transient, so the cell keeps it (module docs).
Source§

impl Clone for Error

Source§

fn clone(&self) -> Self

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, __formatter: &mut Formatter<'_>) -> Result

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

impl Eq for Error

Source§

impl Error for Error

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

Replaced by Error::source.
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<AllocError> for Error

Source§

fn from(source: AllocError) -> Self

Converts to this type from the input type.
Source§

impl From<BudgetExceeded> for Error

Source§

fn from(source: BudgetExceeded) -> Self

Converts to this type from the input type.
Source§

impl From<ChargeError> for Error

Source§

fn from(e: ChargeError) -> Self

Converts to this type from the input type.
Source§

impl From<DetectError> for Error

Source§

fn from(source: DetectError) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for DerefError

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for Error

Source§

fn from(e: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for SaveError

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<LimitError> for Error

Source§

fn from(source: LimitError) -> Self

Converts to this type from the input type.
Source§

impl From<StreamRefusal> for Error

Source§

fn from(e: StreamRefusal) -> Self

Converts to this type from the input type.
Source§

impl From<TreeError> for Error

Source§

fn from(source: TreeError) -> Self

Converts to this type from the input type.
Source§

impl From<VersionError> for Error

Source§

fn from(source: VersionError) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for Error

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Error

Auto Trait Implementations§

§

impl !Freeze for Error

§

impl !RefUnwindSafe for Error

§

impl !UnwindSafe for Error

§

impl Forget for Error

§

impl Move for Error

§

impl Send for Error

§

impl Sync for Error

§

impl Unpin for Error

§

impl UnsafeUnpin 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> Same for T

Source§

type Output = T

Should always be Self
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 = !

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

fn try_from(value: U) -> Result<T, !>

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.