MCPcopy Create free account
hub / github.com/webpack/less-loader / errorFactory

Function errorFactory

src/utils.js:453–473  ·  view source on GitHub ↗

* @param {LessError} error error * @returns {Error} built error

(error)

Source from the content-addressed store, hash-verified

451 * @returns {Error} built error
452 */
453function errorFactory(error) {
454 const message = [
455 "\n",
456 ...getFileExcerptIfPossible(error),
457 error.message.charAt(0).toUpperCase() + error.message.slice(1),
458 error.filename
459 ? ` Error in ${path.normalize(error.filename)} (line ${
460 error.line
461 }, column ${error.column})`
462 : "",
463 ].join("\n");
464
465 const obj = /** @type {Error & { stack: string | null }} */ (
466 new Error(message, { cause: error })
467 );
468
469 // @ts-expect-error avoid extra stack for less
470 obj.stack = null;
471
472 return obj;
473}
474
475export {
476 errorFactory,

Callers 1

lessLoaderFunction · 0.90

Calls 1

getFileExcerptIfPossibleFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…