#[non_exhaustive]
pub enum Error {
    Allocation,
    InvalidString(NulError),
    Utf8(Utf8Error),
    Io(IoError),
    Exception {
        message: StdString,
        file: StdString,
        line: i32,
        stack: StdString,
    },
    FromJs {
        from: &'static str,
        to: &'static str,
        message: Option<StdString>,
    },
    IntoJs {
        from: &'static str,
        to: &'static str,
        message: Option<StdString>,
    },
    NumArgs {
        expected: Range<usize>,
        given: usize,
    },
    Resolving {
        base: StdString,
        name: StdString,
        message: Option<StdString>,
    },
    Loading {
        name: StdString,
        message: Option<StdString>,
    },
    UnrelatedRuntime,
    Unknown,
}
Expand description

Error type of the library.

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.

Allocation

Could not allocate memory This is generally only triggered when out of memory.

InvalidString(NulError)

Found a string with a internal null byte while converting to C string.

Utf8(Utf8Error)

String from rquickjs was not UTF-8

Io(IoError)

An io error

Exception

Fields

message: StdString
file: StdString
line: i32
stack: StdString

An exception raised by quickjs itself.

FromJs

Fields

from: &'static str
to: &'static str
message: Option<StdString>

Error converting from javascript to a rust type.

IntoJs

Fields

from: &'static str
to: &'static str
message: Option<StdString>

Error converting to javascript from a rust type.

NumArgs

Fields

expected: Range<usize>
given: usize

Error matching of function arguments

Resolving

Fields

base: StdString
name: StdString
message: Option<StdString>

Error when resolving js module

Loading

Fields

name: StdString
message: Option<StdString>

Error when loading js module

UnrelatedRuntime

Error when restoring a Persistent in a runtime other than the original runtime.

Unknown

An error from quickjs from which the specifics are unknown. Should eventually be removed as development progresses.

Implementations

Create resolving error

Create resolving error with message

Returns whether the error is a resolving error

Create loading error

Create loading error

Returns whether the error is a loading error

Returns whether the error is a quickjs generated exception.

Create from JS conversion error

Create from JS conversion error with message

Create into JS conversion error

Create into JS conversion error with message

Returns whether the error is a from JS conversion error

Returns whether the error is a from JS to JS type conversion error

Returns whether the error is an into JS conversion error

Create function args mismatch error

Return whether the error is an function args mismatch error

Trait Implementations

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

The lower-level source of this error, if any. Read more

👎 Deprecated since 1.42.0:

use the Display impl or to_string()

👎 Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

🔬 This is a nightly-only experimental API. (error_generic_member_access)

Provides type based access to context intended for error reports. Read more

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.