@@ -60,7 +60,7 @@ function PluginError(plugin, message, opt) {
60
60
// safety object, then we'll get stack overflow problems.
61
61
var safety = {
62
62
toString : function ( ) {
63
- return this . messageDetails + '\nStack:' ;
63
+ return this . messageWithDetails + '\nStack:' ;
64
64
} . bind ( this )
65
65
} ;
66
66
Error . captureStackTrace ( safety , arguments . callee || this . constructor ) ;
@@ -73,17 +73,26 @@ function PluginError(plugin, message, opt) {
73
73
74
74
util . inherits ( PluginError , Error ) ;
75
75
76
+ PluginError . prototype . __defineGetter__ ( 'messageWithDetails' , function ( ) {
77
+ var details = this . messageDetails ;
78
+
79
+ if ( details === '' ) {
80
+ return 'Message:\t ' + this . message ;
81
+ }
82
+
83
+ return 'Message:\t ' + this . message + '\n' + details ;
84
+ } ) ;
85
+
76
86
PluginError . prototype . __defineGetter__ ( 'messageDetails' , function ( ) {
77
- debugger ;
78
87
if ( this . showProperties ) {
79
88
var res = _ ( Object . keys ( this ) )
80
89
. filter ( function ( prop ) { return propertiesNotToDisplay . indexOf ( prop ) === - 1 ; } )
81
90
. map ( function ( prop ) { return '\n ' + prop + ': ' + this [ prop ] ; } , this )
82
91
. reduce ( function ( properties , next ) { return properties + next ; } ) ;
83
92
84
- return 'Message:\n ' + this . message + '\nDetails :' + res ;
93
+ return 'Details :' + res ;
85
94
} else {
86
- return 'Message:\n ' + this . message ;
95
+ return '' ;
87
96
}
88
97
} ) ;
89
98
@@ -94,9 +103,9 @@ PluginError.prototype.toString = function () {
94
103
if ( this . __safety ) {
95
104
msg = this . __safety . stack ;
96
105
} else if ( this . _stack ) {
97
- msg = this . _stack ;
106
+ msg = this . messageWithDetails + '\n' + this . _stack ;
98
107
} else {
99
- msg = this . stack ;
108
+ msg = this . messageWithDetails + '\n' + this . stack ;
100
109
}
101
110
} else {
102
111
msg = this . messageDetails ;
0 commit comments