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 aeca4c0
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 50 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 aeca4c0

Please sign in to comment.