@@ -8,7 +8,7 @@ var nonEnum = ['message', 'name', 'stack'];
88var ignored = union ( nonEnum , [ '__safety' , '_stack' , 'plugin' , 'showProperties' , 'showStack' ] ) ;
99var props = [ 'fileName' , 'lineNumber' , 'message' , 'name' , 'plugin' , 'showProperties' , 'showStack' , 'stack' ] ;
1010
11- function PluginError ( plugin , message , options ) {
11+ function PluginError ( plugin , message , options ) {
1212 if ( ! ( this instanceof PluginError ) ) {
1313 throw new Error ( 'Call PluginError using new' ) ;
1414 }
@@ -22,13 +22,13 @@ function PluginError(plugin, message, options) {
2222 var keys = union ( Object . keys ( opts . error ) , nonEnum ) ;
2323
2424 // These properties are not enumerable, so we have to add them explicitly.
25- keys . forEach ( function ( prop ) {
25+ keys . forEach ( function ( prop ) {
2626 self [ prop ] = opts . error [ prop ] ;
2727 } ) ;
2828 }
2929
3030 // Opts object can override
31- props . forEach ( function ( prop ) {
31+ props . forEach ( function ( prop ) {
3232 if ( prop in opts ) {
3333 this [ prop ] = opts [ prop ] ;
3434 }
@@ -39,7 +39,6 @@ function PluginError(plugin, message, options) {
3939 this . name = 'Error' ;
4040 }
4141 if ( ! this . stack ) {
42-
4342 /**
4443 * `Error.captureStackTrace` appends a stack property which
4544 * relies on the toString method of the object it is applied to.
@@ -50,10 +49,11 @@ function PluginError(plugin, message, options) {
5049 */
5150
5251 var safety = { } ;
53- safety . toString = function ( ) {
52+ safety . toString = function ( ) {
5453 return this . _messageWithDetails ( ) + '\nStack:' ;
5554 } . bind ( this ) ;
5655
56+ // eslint-disable-next-line no-caller
5757 Error . captureStackTrace ( safety , arguments . callee || this . constructor ) ;
5858 this . __safety = safety ;
5959 }
@@ -71,7 +71,7 @@ util.inherits(PluginError, Error);
7171 * Output a formatted message with details
7272 */
7373
74- PluginError . prototype . _messageWithDetails = function ( ) {
74+ PluginError . prototype . _messageWithDetails = function ( ) {
7575 var msg = 'Message:\n ' + this . message ;
7676 var details = this . _messageDetails ( ) ;
7777 if ( details !== '' ) {
@@ -84,7 +84,7 @@ PluginError.prototype._messageWithDetails = function() {
8484 * Output actual message details
8585 */
8686
87- PluginError . prototype . _messageDetails = function ( ) {
87+ PluginError . prototype . _messageDetails = function ( ) {
8888 if ( ! this . showProperties ) {
8989 return '' ;
9090 }
@@ -111,8 +111,8 @@ PluginError.prototype._messageDetails = function() {
111111 * Override the `toString` method
112112 */
113113
114- PluginError . prototype . toString = function ( ) {
115- var detailsWithStack = function ( stack ) {
114+ PluginError . prototype . toString = function ( ) {
115+ var detailsWithStack = function ( stack ) {
116116 return this . _messageWithDetails ( ) + '\nStack:\n' + stack ;
117117 } . bind ( this ) ;
118118
@@ -121,10 +121,8 @@ PluginError.prototype.toString = function() {
121121 // If there is no wrapped error, use the stack captured in the PluginError ctor
122122 if ( this . __safety ) {
123123 msg = this . __safety . stack ;
124-
125124 } else if ( this . _stack ) {
126125 msg = detailsWithStack ( this . _stack ) ;
127-
128126 } else {
129127 // Stack from wrapped error
130128 msg = detailsWithStack ( this . stack ) ;
@@ -137,7 +135,7 @@ PluginError.prototype.toString = function() {
137135} ;
138136
139137// Format the output message
140- function message ( msg , thisArg ) {
138+ function message ( msg , thisArg ) {
141139 var sig = colors . red ( thisArg . name ) ;
142140 sig += ' in plugin ' ;
143141 sig += '"' + colors . cyan ( thisArg . plugin ) + '"' ;
@@ -150,7 +148,7 @@ function message(msg, thisArg) {
150148 * Set default options based on arguments.
151149 */
152150
153- function setDefaults ( plugin , message , opts ) {
151+ function setDefaults ( plugin , message , opts ) {
154152 if ( typeof plugin === 'object' ) {
155153 return defaults ( plugin ) ;
156154 }
@@ -176,10 +174,10 @@ function setDefaults(plugin, message, opts) {
176174 * @return {Object }
177175 */
178176
179- function defaults ( opts ) {
177+ function defaults ( opts ) {
180178 return extend ( {
181179 showStack : false ,
182- showProperties : true ,
180+ showProperties : true
183181 } , opts ) ;
184182}
185183
0 commit comments