MCPcopy
hub / github.com/webpack/webpack / tryRunOrWebpackError

Function tryRunOrWebpackError

lib/errors/HookWebpackError.js:111–123  ·  view source on GitHub ↗
(fn, hook)

Source from the content-addressed store, hash-verified

109 * @returns {T} the result
110 */
111const tryRunOrWebpackError = (fn, hook) => {
112 /** @type {T} */
113 let r;
114 try {
115 r = fn();
116 } catch (err) {
117 if (err instanceof WebpackError) {
118 throw err;
119 }
120 throw new HookWebpackError(/** @type {Error} */ (err), hook);
121 }
122 return r;
123};
124
125module.exports.tryRunOrWebpackError = tryRunOrWebpackError;

Callers 7

renderModuleMethod · 0.85
renderChunkMethod · 0.85
renderMainMethod · 0.85
renderRequireMethod · 0.85
renderModuleMethod · 0.85
renderModuleMethod · 0.85

Calls 1

fnFunction · 0.50

Tested by

no test coverage detected