npkgz / gulp-prettyerror

:hash: Display Errors in a pretty way, without breaking watch tasks
https://www.npmjs.com/package/gulp-prettyerror
MIT License
14 stars 1 forks source link

PrettyError make error - "Cannot read property 'message' of null" #7

Closed bredziniak closed 7 years ago

bredziniak commented 7 years ago

When task with handling errors by PrettyErrors have error i get this error and stop Watch. `C:\Users\Sasi\PhpstormProjects\novekino\node_modules\gulp-prettyerror\gulp-prettyerror.js:30 if (cause.message){ ^

TypeError: Cannot read property 'message' of null at DestroyableTransform.errorHandler (C:\Users\Sasi\PhpstormProjects\novekino\node_modules\gulp-prettyerror\gulp-prettyerror.js:30:22) at emitOne (events.js:101:20) at DestroyableTransform.emit (events.js:188:7) at onwriteError (C:\Users\Sasi\PhpstormProjects\novekino\node_modules\through2\node_modules\readable-stream\lib_stream_writable.js:356:10) at onwrite (C:\Users\Sasi\PhpstormProjects\novekino\node_modules\through2\node_modules\readable-stream\lib_stream_writable.js:373:11) at WritableState.onwrite (C:\Users\Sasi\PhpstormProjects\novekino\node_modules\through2\node_modules\readable-stream\lib_stream_writable.js:126:5) at afterTransform (C:\Users\Sasi\PhpstormProjects\novekino\node_modules\through2\node_modules\readable-stream\lib_stream_transform.js:81:3) at TransformState.afterTransform (C:\Users\Sasi\PhpstormProjects\novekino\node_modules\through2\node_modules\readable-stream\lib_stream_transform.js:58:12) at DestroyableTransform.minify [as _transform] (C:\Users\Sasi\PhpstormProjects\novekino\node_modules\gulp-uglify\minifier.js:71:14) at DestroyableTransform.Transform._read (C:\Users\Sasi\PhpstormProjects\novekino\node_modules\through2\node_modules\readable-stream\lib_stream_transform.js:159:10) at DestroyableTransform.Transform._write (C:\Users\Sasi\PhpstormProjects\novekino\node_modules\through2\node_modules\readable-stream\lib_stream_transform.js:147:83) at doWrite (C:\Users\Sasi\PhpstormProjects\novekino\node_modules\through2\node_modules\readable-stream\lib_stream_writable.js:347:64) at writeOrBuffer (C:\Users\Sasi\PhpstormProjects\novekino\node_modules\through2\node_modules\readable-stream\lib_stream_writable.js:336:5) at DestroyableTransform.Writable.write (C:\Users\Sasi\PhpstormProjects\novekino\node_modules\through2\node_modules\readable-stream\lib_stream_writable.js:274:11) at DestroyableTransform.ondata (C:\Users\Sasi\PhpstormProjects\novekino\node_modules\through2\node_modules\readable-stream\lib_stream_readable.js:546:20) at emitOne (events.js:96:13) `

AndiDittrich commented 7 years ago

I will check this soon

AndiDittrich commented 7 years ago

Thank you Sasmen!

it is fixed in v1.2.1 - in case the error.cause property is not set, it will become an empty object

var cause = error.cause || {};