diff --git a/ext/napi/lib.rs b/ext/napi/lib.rs index 22d86e4a9b..ada9aa13fb 100644 --- a/ext/napi/lib.rs +++ b/ext/napi/lib.rs @@ -647,12 +647,13 @@ where // SAFETY: we are going blind, calling the register function on the other side. let maybe_exports = unsafe { - let init = library + let Ok(init) = library .get:: napi_value>(b"napi_register_module_v1") - .expect("napi_register_module_v1 not found"); + ) -> napi_value>(b"napi_register_module_v1") else { + return Err(type_error(format!("Unable to find napi_register_module_v1 symbol in {}", path))); + }; init( env_ptr, std::mem::transmute::, napi_value>(exports.into()),