MCPcopy Index your code
hub / github.com/nodejs/node / guard

Function guard

deps/v8/test/mjsunit/try.js:60–60  ·  view source on GitHub ↗
(f)

Source from the content-addressed store, hash-verified

58assertEquals(5, f({}, 'bar', 5).bar);
59
60function guard(f) { try { f(); } catch (o) { return o; } }
61assertEquals('baz', guard(function() { throw 'baz'; }));
62assertEquals(2, (function() { try { throw {}; } catch(e) {} finally { return 2; } })());
63assertEquals(1, guard(function() { try { throw 1; } finally { } }));

Callers 1

try.jsFile · 0.85

Calls 1

fFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…