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> {