throw if napi function returns Err variant of Result<T>
This commit is contained in:
parent
ee7a146ea1
commit
f66f79e587
12 changed files with 53 additions and 37 deletions
crates/napi/src/bindgen_runtime
|
@ -47,15 +47,10 @@ impl<const N: usize> CallbackInfo<N> {
|
|||
}
|
||||
|
||||
pub fn get_arg(&self, index: usize) -> sys::napi_value {
|
||||
*self
|
||||
.args
|
||||
.get(index)
|
||||
.unwrap_or_else(|| panic!("index {} must < {}", index, N))
|
||||
self.args[index]
|
||||
}
|
||||
|
||||
pub fn this(&self) -> sys::napi_value {
|
||||
debug_assert!(!self.this.is_null());
|
||||
|
||||
self.this
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue