This repository has been archived on 2020-11-02. You can view files and clone it, but cannot push or open issues or pull requests.
2020-11-01 22:46:04 +00:00

36 lines
656 B
JavaScript

"use strict";
/**
* **PostCSS Plugin Warning**
*
* Loader wrapper for postcss plugin warnings (`root.messages`)
*
* @class Warning
* @extends Error
*
* @param {Object} warning PostCSS Warning
*/
class Warning extends Error {
constructor(warning) {
super(warning);
const {
text,
line,
column,
plugin
} = warning;
this.name = 'Warning';
this.message = `${this.name}\n\n`;
if (typeof line !== 'undefined') {
this.message += `(${line}:${column}) `;
}
this.message += plugin ? `${plugin}: ` : '';
this.message += `${text}`;
this.stack = false;
}
}
module.exports = Warning;