SassError.js 969 B

1234567891011121314151617181920212223242526272829303132333435
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = void 0;
  6. class SassError extends Error {
  7. constructor(sassError) {
  8. super();
  9. this.name = "SassError"; // Instruct webpack to hide the JS stack from the console.
  10. // Usually you're only interested in the SASS error in this case.
  11. this.hideStack = true;
  12. Error.captureStackTrace(this, this.constructor);
  13. if (typeof sassError.line !== "undefined" || typeof sassError.column !== "undefined") {
  14. this.loc = {
  15. line: sassError.line,
  16. column: sassError.column
  17. };
  18. } // Keep original error if `sassError.formatted` is unavailable
  19. this.message = `${this.name}: ${typeof sassError.message !== "undefined" ? sassError.message : sassError}`;
  20. if (sassError.formatted) {
  21. this.message = `${this.name}: ${sassError.formatted.replace(/^Error: /, "")}`;
  22. }
  23. }
  24. }
  25. var _default = SassError;
  26. exports.default = _default;