pub struct JsFault { /* private fields */ }Expand description
A failure on the JavaScript side of a walk or a build: a getter threw, a string had an unpaired surrogate, a value was of a type that cannot be encrypted, a tree was too deep.
A napi Error is not Send, so it cannot travel inside a
SourceError; this carries its status and reason, which is all a
caller needs to hand it back to JavaScript. A Status::PendingException
means the original JavaScript exception is still pending in the engine,
and returning this error lets it surface unchanged.
Implementations§
Source§impl JsFault
impl JsFault
Sourcepub fn status(&self) -> Status
pub fn status(&self) -> Status
The napi status of the failure. Status::PendingException means a
JavaScript exception is still pending: return this error to
JavaScript before running any more JavaScript, so the exception
surfaces as it was thrown.
Sourcepub fn from_source(error: &SourceError) -> Error
pub fn from_source(error: &SourceError) -> Error
The napi error for a source error, which is a JsFault when the
source was a JavaScript value and some other error otherwise.
Trait Implementations§
impl Eq for JsFault
Source§impl Error for JsFault
impl Error for JsFault
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()