#[repr(transparent)]pub struct JsError(_);
Expand description
A JS Error
object.
Implementations
sourceimpl JsError
impl JsError
sourcepub fn error<'a, C: Context<'a>, S: AsRef<str>>(
cx: &mut C,
msg: S
) -> NeonResult<Handle<'a, JsError>>
pub fn error<'a, C: Context<'a>, S: AsRef<str>>(
cx: &mut C,
msg: S
) -> NeonResult<Handle<'a, JsError>>
Creates a direct instance of the Error
class.
sourcepub fn type_error<'a, C: Context<'a>, S: AsRef<str>>(
cx: &mut C,
msg: S
) -> NeonResult<Handle<'a, JsError>>
pub fn type_error<'a, C: Context<'a>, S: AsRef<str>>(
cx: &mut C,
msg: S
) -> NeonResult<Handle<'a, JsError>>
Creates an instance of the TypeError
class.
sourcepub fn range_error<'a, C: Context<'a>, S: AsRef<str>>(
cx: &mut C,
msg: S
) -> NeonResult<Handle<'a, JsError>>
pub fn range_error<'a, C: Context<'a>, S: AsRef<str>>(
cx: &mut C,
msg: S
) -> NeonResult<Handle<'a, JsError>>
Creates an instance of the RangeError
class.
Trait Implementations
sourceimpl Object for JsError
impl Object for JsError
sourcefn get_opt<'a, V: Value, C: Context<'a>, K: PropertyKey>(
&self,
cx: &mut C,
key: K
) -> NeonResult<Option<Handle<'a, V>>>
fn get_opt<'a, V: Value, C: Context<'a>, K: PropertyKey>(
&self,
cx: &mut C,
key: K
) -> NeonResult<Option<Handle<'a, V>>>
Gets a property from a JavaScript object that may be undefined
and
attempts to downcast the value if it existed. Read more
sourcefn get_value<'a, C: Context<'a>, K: PropertyKey>(
&self,
cx: &mut C,
key: K
) -> NeonResult<Handle<'a, JsValue>>
fn get_value<'a, C: Context<'a>, K: PropertyKey>(
&self,
cx: &mut C,
key: K
) -> NeonResult<Handle<'a, JsValue>>
sourcefn get<'a, V: Value, C: Context<'a>, K: PropertyKey>(
&self,
cx: &mut C,
key: K
) -> NeonResult<Handle<'a, V>>
fn get<'a, V: Value, C: Context<'a>, K: PropertyKey>(
&self,
cx: &mut C,
key: K
) -> NeonResult<Handle<'a, V>>
Gets a property from a JavaScript object and attempts to downcast as a specific type.
Equivalent to calling obj.get(&mut cx)?.downcast_or_throw(&mut cx)
. Read more
sourcefn get_own_property_names<'a, C: Context<'a>>(
&self,
cx: &mut C
) -> JsResult<'a, JsArray>
fn get_own_property_names<'a, C: Context<'a>>(
&self,
cx: &mut C
) -> JsResult<'a, JsArray>
This is supported on crate feature
napi-6
only.fn set<'a, C: Context<'a>, K: PropertyKey, W: Value>(
&self,
cx: &mut C,
key: K,
val: Handle<'_, W>
) -> NeonResult<bool>
fn root<'a, C: Context<'a>>(&self, cx: &mut C) -> Root<Self>
Auto Trait Implementations
impl RefUnwindSafe for JsError
impl !Send for JsError
impl !Sync for JsError
impl Unpin for JsError
impl UnwindSafe for JsError
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more