From be8e88fb1da53b6af7db6e5254e91cb50d7ff3b3 Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Mon, 27 Jun 2022 09:20:02 +0000 Subject: [PATCH] fix: hide error stacktrace on Sass errors Stacktraces can bloat the output with information that is not needed for the user to fix a Sass related syntax error. Closes #1068 --- src/SassError.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/SassError.js b/src/SassError.js index 4b8a9750..d602aa9e 100644 --- a/src/SassError.js +++ b/src/SassError.js @@ -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" @@ -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); } } }