Skip to content

Commit 5e6a61b

Browse files
authored
fix: hide error stacktrace on Sass errors (#1069)
1 parent 5f0658e commit 5e6a61b

File tree

2 files changed

+49
-50
lines changed

2 files changed

+49
-50
lines changed

src/SassError.js

+5-6
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ class SassError extends Error {
44

55
this.name = "SassError";
66

7+
// Instruct webpack to hide the JS stack from the console.
8+
// Usually you're only interested in the SASS error in this case.
9+
this.hideStack = true;
10+
Error.captureStackTrace(this, this.constructor);
11+
712
if (
813
typeof sassError.line !== "undefined" ||
914
typeof sassError.column !== "undefined"
@@ -24,12 +29,6 @@ class SassError extends Error {
2429
/^Error: /,
2530
""
2631
)}`;
27-
28-
// Instruct webpack to hide the JS stack from the console.
29-
// Usually you're only interested in the SASS stack in this case.
30-
this.hideStack = true;
31-
32-
Error.captureStackTrace(this, this.constructor);
3332
}
3433
}
3534
}

0 commit comments

Comments
 (0)