diff --git a/build.rs b/build.rs index c1e2a459..321eedf1 100644 --- a/build.rs +++ b/build.rs @@ -53,7 +53,13 @@ fn main() { // Activate the "node8" or "nodestable" feature for compatibility with // different versions of Node.js/N-API. - println!("cargo:rustc-cfg=node{}", node_major_version); + println!("cargo:rustc-cfg=node{}", if node_major_version > 8 { + "stable" + } else if node_major_version == 8 { + "8" + } else { + panic!("node version is too low") + }); bindgen::Builder::default() .header("src/sys/bindings.h") diff --git a/src/sys/stable.rs b/src/sys/stable.rs index ca64c52b..f94440aa 100644 --- a/src/sys/stable.rs +++ b/src/sys/stable.rs @@ -18,6 +18,10 @@ pub enum Status { HandleScopeMismatch, CallbackScopeMismatch, StringContainsNull, + QueueFull, + Closing, + BigintExpected, + Unknown, } impl From for Status { @@ -41,6 +45,10 @@ impl From for Status { napi_escape_called_twice => EscapeCalledTwice, napi_handle_scope_mismatch => HandleScopeMismatch, napi_callback_scope_mismatch => CallbackScopeMismatch, + napi_queue_full => QueueFull, + napi_closing => Closing, + napi_bigint_expected => BigintExpected, + _ => Unknown, } } }