From 35a8858e5c758dfaa3bc3e68a9a4beaaeb01404d Mon Sep 17 00:00:00 2001 From: David Herman Date: Tue, 14 Jul 2020 13:31:06 -0700 Subject: [PATCH] Remove unnecessary `UnwindSafe` requirement for N-API version of public `try_catch` API. --- src/context/mod.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/context/mod.rs b/src/context/mod.rs index 786912289..25c05bbe1 100644 --- a/src/context/mod.rs +++ b/src/context/mod.rs @@ -226,7 +226,14 @@ pub trait Context<'a>: ContextInternal<'a> { result } - #[cfg(feature = "try-catch-api")] + #[cfg(all(feature = "try-catch-api", feature = "napi-runtime"))] + fn try_catch<'b: 'a, F>(&mut self, f: F) -> Result, Handle<'a, JsValue>> + where F: FnOnce(&mut Self) -> JsResult<'b, JsValue> + { + self.try_catch_internal(f) + } + + #[cfg(all(feature = "try-catch-api", feature = "legacy-runtime"))] fn try_catch<'b: 'a, F>(&mut self, f: F) -> Result, Handle<'a, JsValue>> where F: UnwindSafe + FnOnce(&mut Self) -> JsResult<'b, JsValue> {