@@ -559,55 +559,55 @@ function reportError(loaderContext, callback, error) {
559
559
}
560
560
}
561
561
562
- function warningFactory ( obj ) {
562
+ function warningFactory ( warning ) {
563
563
let message = "" ;
564
564
565
- if ( typeof obj . line !== "undefined" ) {
566
- message += `(${ obj . line } :${ obj . column } ) ` ;
565
+ if ( typeof warning . line !== "undefined" ) {
566
+ message += `(${ warning . line } :${ warning . column } ) ` ;
567
567
}
568
568
569
- if ( typeof obj . plugin !== "undefined" ) {
570
- message += `from "${ obj . plugin } " plugin: ` ;
569
+ if ( typeof warning . plugin !== "undefined" ) {
570
+ message += `from "${ warning . plugin } " plugin: ` ;
571
571
}
572
572
573
- message += obj . text ;
573
+ message += warning . text ;
574
574
575
- if ( obj . node ) {
576
- message += `\n\nCode:\n ${ obj . node . toString ( ) } \n` ;
575
+ if ( warning . node ) {
576
+ message += `\n\nCode:\n ${ warning . node . toString ( ) } \n` ;
577
577
}
578
578
579
- const warning = new Error ( message ) ;
579
+ const obj = new Error ( message , { cause : warning } ) ;
580
580
581
- warning . stack = null ;
581
+ obj . stack = null ;
582
582
583
- return warning ;
583
+ return obj ;
584
584
}
585
585
586
- function syntaxErrorFactory ( obj ) {
586
+ function syntaxErrorFactory ( error ) {
587
587
let message = "\nSyntaxError\n\n" ;
588
588
589
- if ( typeof obj . line !== "undefined" ) {
590
- message += `(${ obj . line } :${ obj . column } ) ` ;
589
+ if ( typeof error . line !== "undefined" ) {
590
+ message += `(${ error . line } :${ error . column } ) ` ;
591
591
}
592
592
593
- if ( typeof obj . plugin !== "undefined" ) {
594
- message += `from "${ obj . plugin } " plugin: ` ;
593
+ if ( typeof error . plugin !== "undefined" ) {
594
+ message += `from "${ error . plugin } " plugin: ` ;
595
595
}
596
596
597
- message += obj . file ? `${ obj . file } ` : "<css input> " ;
598
- message += `${ obj . reason } ` ;
597
+ message += error . file ? `${ error . file } ` : "<css input> " ;
598
+ message += `${ error . reason } ` ;
599
599
600
- const code = obj . showSourceCode ( ) ;
600
+ const code = error . showSourceCode ( ) ;
601
601
602
602
if ( code ) {
603
603
message += `\n\n${ code } \n` ;
604
604
}
605
605
606
- const error = new Error ( message ) ;
606
+ const obj = new Error ( message , { cause : error } ) ;
607
607
608
- error . stack = null ;
608
+ obj . stack = null ;
609
609
610
- return error ;
610
+ return obj ;
611
611
}
612
612
613
613
export {
0 commit comments