Trait JsErrorClass

Source
pub trait JsErrorClass:
    Error
    + Send
    + Sync
    + Any
    + 'static {
    // Required methods
    fn get_class(&self) -> Cow<'static, str>;
    fn get_message(&self) -> Cow<'static, str>;
    fn get_additional_properties(
        &self,
    ) -> Vec<(Cow<'static, str>, Cow<'static, str>)>;
    fn as_any(&self) -> &dyn Any;
}
Expand description

Trait to implement how an error should be represented in JavaScript.

Note: it is not recommended to manually implement this type, but instead rather use the JsError macro.

Required Methods§

Source

fn get_class(&self) -> Cow<'static, str>

Represents the error class used in JavaScript side.

Source

fn get_message(&self) -> Cow<'static, str>

Represents the error message used in JavaScript side.

Source

fn get_additional_properties( &self, ) -> Vec<(Cow<'static, str>, Cow<'static, str>)>

Additional properties that should be defined on the error in JavaScript side.

Source

fn as_any(&self) -> &dyn Any

Implementations on Foreign Types§

Source§

impl JsErrorClass for Infallible

Source§

fn get_class(&self) -> Cow<'static, str>

Source§

fn get_message(&self) -> Cow<'static, str>

Source§

fn get_additional_properties( &self, ) -> Vec<(Cow<'static, str>, Cow<'static, str>)>

Source§

fn as_any(&self) -> &dyn Any

Source§

impl JsErrorClass for VarError

Source§

fn get_class(&self) -> Cow<'static, str>

Source§

fn get_message(&self) -> Cow<'static, str>

Source§

fn get_additional_properties( &self, ) -> Vec<(Cow<'static, str>, Cow<'static, str>)>

Source§

fn as_any(&self) -> &dyn Any

Source§

impl JsErrorClass for TryFromIntError

Source§

fn get_class(&self) -> Cow<'static, str>

Source§

fn get_message(&self) -> Cow<'static, str>

Source§

fn get_additional_properties( &self, ) -> Vec<(Cow<'static, str>, Cow<'static, str>)>

Source§

fn as_any(&self) -> &dyn Any

Source§

impl JsErrorClass for Utf8Error

Source§

fn get_class(&self) -> Cow<'static, str>

Source§

fn get_message(&self) -> Cow<'static, str>

Source§

fn get_additional_properties( &self, ) -> Vec<(Cow<'static, str>, Cow<'static, str>)>

Source§

fn as_any(&self) -> &dyn Any

Source§

impl JsErrorClass for Error

Source§

fn get_class(&self) -> Cow<'static, str>

Source§

fn get_message(&self) -> Cow<'static, str>

Source§

fn get_additional_properties( &self, ) -> Vec<(Cow<'static, str>, Cow<'static, str>)>

Source§

fn as_any(&self) -> &dyn Any

Source§

impl JsErrorClass for RecvError

Source§

fn get_class(&self) -> Cow<'static, str>

Source§

fn get_message(&self) -> Cow<'static, str>

Source§

fn get_additional_properties( &self, ) -> Vec<(Cow<'static, str>, Cow<'static, str>)>

Source§

fn as_any(&self) -> &dyn Any

Source§

impl<T: JsErrorClass> JsErrorClass for Box<T>

Source§

fn get_class(&self) -> Cow<'static, str>

Source§

fn get_message(&self) -> Cow<'static, str>

Source§

fn get_additional_properties( &self, ) -> Vec<(Cow<'static, str>, Cow<'static, str>)>

Source§

fn as_any(&self) -> &dyn Any

Implementors§