summaryrefslogtreecommitdiff
path: root/ext/napi/lib.rs
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2023-01-15 04:36:55 +0100
committerGitHub <noreply@github.com>2023-01-15 09:06:55 +0530
commitdf8bfa26be69af46b8f166e255330b5ba8d48893 (patch)
treee6aa1dec47e82d5cf2b3b01583a2c7fcb099e741 /ext/napi/lib.rs
parente4c6e6e95f626b1ce8601f48344a76045f2d6479 (diff)
fix(napi): functions related to errors (#17370)
This commits fixes various NAPI functions related to creation and throwing of errors.
Diffstat (limited to 'ext/napi/lib.rs')
-rw-r--r--ext/napi/lib.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/ext/napi/lib.rs b/ext/napi/lib.rs
index 22b0e3a08..1cb1b7c26 100644
--- a/ext/napi/lib.rs
+++ b/ext/napi/lib.rs
@@ -311,7 +311,7 @@ pub struct napi_extended_error_info {
pub error_message: *const c_char,
pub engine_reserved: *mut c_void,
pub engine_error_code: i32,
- pub status_code: napi_status,
+ pub error_code: napi_status,
}
#[repr(C)]
@@ -416,6 +416,7 @@ pub struct Env {
pub cleanup_hooks:
Rc<RefCell<Vec<(extern "C" fn(*const c_void), *const c_void)>>>,
pub tsfn_ref_counters: Rc<RefCell<ThreadsafeFunctionRefCounters>>,
+ pub last_error: napi_extended_error_info,
}
unsafe impl Send for Env {}
@@ -450,6 +451,12 @@ impl Env {
threadsafe_function_sender,
cleanup_hooks,
tsfn_ref_counters,
+ last_error: napi_extended_error_info {
+ error_message: std::ptr::null(),
+ engine_reserved: std::ptr::null_mut(),
+ engine_error_code: 0,
+ error_code: napi_ok,
+ },
}
}