(fn, hook)
| 109 | * @returns {T} the result |
| 110 | */ |
| 111 | const 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 | |
| 125 | module.exports.tryRunOrWebpackError = tryRunOrWebpackError; |
no test coverage detected