Error.js
642 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/**
* **PostCSS Syntax Error**
*
* Loader wrapper for postcss syntax errors
*
* @class SyntaxError
* @extends Error
*
* @param {Object} err CssSyntaxError
*/
class SyntaxError extends Error {
constructor (error) {
super(error)
const { line, column, reason } = error
this.name = 'SyntaxError'
this.message = `${this.name}\n\n`
if (typeof line !== 'undefined') {
this.message += `(${line}:${column}) `
}
this.message += `${reason}`
const code = error.showSourceCode()
if (code) {
this.message += `\n\n${code}\n`
}
this.stack = false
}
}
module.exports = SyntaxError