File tree 2 files changed +17
-7
lines changed
2 files changed +17
-7
lines changed Original file line number Diff line number Diff line change 9
9
* @param {Object } err CssSyntaxError
10
10
*/
11
11
class SyntaxError extends Error {
12
- constructor ( err ) {
13
- super ( err )
12
+ constructor ( error ) {
13
+ super ( error )
14
14
15
- const { line, column, reason } = err
15
+ const { line, column, reason } = error
16
16
17
17
this . name = 'SyntaxError'
18
18
19
- this . message = ''
20
- this . message += `${ this . name } \n\n(${ line } :${ column } ) ${ reason } `
21
- this . message += `\n\n${ err . showSourceCode ( ) } \n`
19
+ this . message = `${ this . name } \n\n`
20
+
21
+ if ( typeof line !== 'undefined' ) {
22
+ this . message += `(${ line } :${ column } ) `
23
+ }
24
+
25
+ this . message += `${ reason } `
26
+
27
+ const code = error . showSourceCode ( )
28
+
29
+ if ( code ) {
30
+ this . message += `\n\n${ code } \n`
31
+ }
22
32
23
33
this . stack = false
24
34
}
Original file line number Diff line number Diff line change 1
1
// Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
3
3
exports [` Errors Syntax Error 1` ] = `
4
- "SyntaxError
4
+ "SyntaxError
5
5
6
6
(1:3) Unexpected separator in property
7
7
You can’t perform that action at this time.
0 commit comments