Skip to content

Commit

Permalink
fix: hide error stacktrace on Sass errors
Browse files Browse the repository at this point in the history
Stacktraces can bloat the output with information that is not needed for the user to fix a Sass related syntax error.

Closes #1068
  • Loading branch information
alan-agius4 committed Jun 27, 2022
1 parent 5f0658e commit be8e88f
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/SassError.js
Expand Up @@ -4,6 +4,11 @@ class SassError extends Error {

this.name = "SassError";

// Instruct webpack to hide the JS stack from the console.
// Usually you're only interested in the SASS error in this case.
this.hideStack = true;
Error.captureStackTrace(this, this.constructor);

if (
typeof sassError.line !== "undefined" ||
typeof sassError.column !== "undefined"
Expand All @@ -24,12 +29,6 @@ class SassError extends Error {
/^Error: /,
""
)}`;

// Instruct webpack to hide the JS stack from the console.
// Usually you're only interested in the SASS stack in this case.
this.hideStack = true;

Error.captureStackTrace(this, this.constructor);
}
}
}
Expand Down

0 comments on commit be8e88f

Please sign in to comment.