pub type Result = napi::Result; pub trait NapiErrorExt { /// Convert to a napi error using from_reason(err.to_string()) fn default_error(self) -> Result; } impl NapiErrorExt for std::result::Result { fn default_error(self) -> Result { self.map_err(|err| napi::Error::from_reason(err.to_string())) } }