pub enum JsError {
Type(String),
Range(String),
Error(String),
Fields(Box<ErrorFields>),
}Expand description
An error of a chosen JS class: what Result<T, JsError> throws, and
what a Later task’s Err(JsError) rejects with (any other error
type is an Error with its message). JsError::with_code and
JsError::with give it properties, as Node’s errors have
(error.code === "ENOENT"; TS: Error & { code?: string }).
Variants§
Type(String)
A TypeError: the call was not allowed or its value is wrong.
Range(String)
A RangeError: a value past a limit.
Error(String)
An Error.
Fields(Box<ErrorFields>)
One of those with properties.
Implementations§
Source§impl JsError
impl JsError
Sourcepub fn with(self, key: &'static str, value: impl Into<JsonValue>) -> Self
pub fn with(self, key: &'static str, value: impl Into<JsonValue>) -> Self
The error with property key set to value (replacing one of the
same name).
Sourcepub fn access_denied(
message: impl Into<String>,
permission: &str,
resource: impl Into<String>,
) -> Self
pub fn access_denied( message: impl Into<String>, permission: &str, resource: impl Into<String>, ) -> Self
What a call the app’s capabilities do not grant fails with, as
Node’s permission model: an Error with code
codes::ACCESS_DENIED, permission (the capability: "fs",
"network", "clipboard", …) and resource (the path, URL or
name asked for; "" when the capability has none).
Trait Implementations§
impl Eq for JsError
Source§impl From<Error> for JsError
An I/O error as Node reports it: Error with the message and the
code of its kind or OS error (ENOENT, EACCES, …; none when it
has no name).
impl From<Error> for JsError
An I/O error as Node reports it: Error with the message and the
code of its kind or OS error (ENOENT, EACCES, …; none when it
has no name).
Source§impl IntoThrown for JsError
impl IntoThrown for JsError
Source§fn into_thrown(self) -> Thrown
fn into_thrown(self) -> Thrown
impl StructuralPartialEq for JsError
Auto Trait Implementations§
impl Forget for JsError
impl Freeze for JsError
impl Move for JsError
impl RefUnwindSafe for JsError
impl Send for JsError
impl Sync for JsError
impl Unpin for JsError
impl UnsafeUnpin for JsError
impl UnwindSafe for JsError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.