SassError.js 971 B

12345678910111213141516171819202122232425262728293031
  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";
  10. // Instruct webpack to hide the JS stack from the console.
  11. // Usually you're only interested in the SASS error in this case.
  12. this.hideStack = true;
  13. Error.captureStackTrace(this, this.constructor);
  14. if (typeof sassError.line !== "undefined" || typeof sassError.column !== "undefined") {
  15. this.loc = {
  16. line: sassError.line,
  17. column: sassError.column
  18. };
  19. }
  20. // Keep original error if `sassError.formatted` is unavailable
  21. this.message = `${this.name}: ${typeof sassError.message !== "undefined" ? sassError.message : sassError}`;
  22. if (sassError.formatted) {
  23. this.message = `${this.name}: ${sassError.formatted.replace(/^Error: /, "")}`;
  24. }
  25. }
  26. }
  27. var _default = SassError;
  28. exports.default = _default;