Enum rquickjs_core::Error[][src]

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>,
    },
    Unknown,
}

Error type of the library.

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

An io error

Exception

An exception raised by quickjs itself.

Fields of Exception

message: StdStringfile: StdStringline: i32stack: StdString
FromJs

Error converting from javascript to a rust type.

Fields of FromJs

from: &'static strto: &'static strmessage: Option<StdString>
IntoJs

Error converting to javascript from a rust type.

Fields of IntoJs

from: &'static strto: &'static strmessage: Option<StdString>
NumArgs

Error matching of function arguments

Fields of NumArgs

expected: Range<usize>given: usize
Resolving

Error when resolving js module

Fields of Resolving

base: StdStringname: StdStringmessage: Option<StdString>
Loading

Error when loading js module

Fields of Loading

name: StdStringmessage: Option<StdString>
Unknown

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

Implementations

impl Error[src]

pub fn new_resolving<B, N>(base: B, name: N) -> Self where
    StdString: From<B> + From<N>, 
[src]

Create resolving error

pub fn new_resolving_message<B, N, M>(base: B, name: N, msg: M) -> Self where
    StdString: From<B> + From<N> + From<M>, 
[src]

Create resolving error with message

pub fn is_resolving(&self) -> bool[src]

Returns whether the error is a resolving error

pub fn new_loading<N>(name: N) -> Self where
    StdString: From<N>, 
[src]

Create loading error

pub fn new_loading_message<N, M>(name: N, msg: M) -> Self where
    StdString: From<N> + From<M>, 
[src]

Create loading error

pub fn is_loading(&self) -> bool[src]

Returns whether the error is a loading error

pub fn is_exception(&self) -> bool[src]

Returns whether the error is a quickjs generated exception.

pub fn new_from_js(from: &'static str, to: &'static str) -> Self[src]

Create from JS conversion error

pub fn new_from_js_message<M>(
    from: &'static str,
    to: &'static str,
    msg: M
) -> Self where
    StdString: From<M>, 
[src]

Create from JS conversion error with message

pub fn new_into_js(from: &'static str, to: &'static str) -> Self[src]

Create into JS conversion error

pub fn new_into_js_message<M>(
    from: &'static str,
    to: &'static str,
    msg: M
) -> Self where
    StdString: From<M>, 
[src]

Create into JS conversion error with message

pub fn is_from_js(&self) -> bool[src]

Returns whether the error is a from JS conversion error

pub fn is_from_js_to_js(&self) -> bool[src]

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

pub fn is_into_js(&self) -> bool[src]

Returns whether the error is an into JS conversion error

pub fn new_num_args(expected: Range<usize>, given: usize) -> Self[src]

Create function args mismatch error

pub fn is_num_args(&self) -> bool[src]

Return whether the error is an function args mismatch error

Trait Implementations

impl Debug for Error[src]

impl Display for Error[src]

impl Error for Error[src]

impl From<Error> for Error[src]

impl From<FromUtf8Error> for Error[src]

impl From<NulError> for Error[src]

impl From<Utf8Error> for Error[src]

impl<'js> FromJs<'js> for Error[src]

impl<'js> IntoJs<'js> for &Error[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.