Macro js_error_wrapper

Source
macro_rules! js_error_wrapper {
    ($err_path:path, $err_name:ident, $js_err_type:tt) => { ... };
    ($err_path:path, $err_name:ident, |$inner:ident| $js_err_type:tt) => { ... };
}
Expand description

Macro which lets you wrap an existing error in a new error that implements the JsErrorClass trait. This macro however does currently not support the special identifiers that the JsError macro supports.

ยงExamples

js_error_wrapper!(std::net::AddrParseError, JsAddrParseError, "TypeError");
js_error_wrapper!(std::net::AddrParseError, JsAddrParseError, |err| {
  // match or do some logic to get the error class
  "TypeError"
});