MCPcopy
hub / github.com/webpack/webpack / catchError

Function catchError

test/parseJson.unittest.js:13–20  ·  view source on GitHub ↗
(/** @type {() => void} */ fn)

Source from the content-addressed store, hash-verified

11// is exercised directly against synthetic messages to stay engine-independent.
12
13const catchError = (/** @type {() => void} */ fn) => {
14 try {
15 fn();
16 } catch (err) {
17 return /** @type {JSONParseError} */ (err);
18 }
19 throw new Error("expected parseJson to throw");
20};
21
22describe("parseJson", () => {
23 it("parses JSON", () => {

Callers 1

Calls 1

fnFunction · 0.50

Tested by

no test coverage detected