Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gulp: Better error messages #1741

Merged
merged 1 commit into from
Feb 15, 2019

Conversation

RunDevelopment
Copy link
Member

After I tried (and failed) for half an hour to find the line that caused uglify to fail, I decided it's (finally) time for proper error messages using pump.

Example

pump will transform

... more gulp log ...
[15:12:04] Starting 'plugins'...
[15:12:04] Finished 'build' after 195 ms
[15:12:05] Finished 'plugins' after 676 ms

events.js:167
      throw er; // Unhandled 'error' event
      ^
Error
    at new JS_Parse_Error (D:\Documents\GitHub\prism\node_modules\uglify-js\lib\parse.js:196:18)
    at js_error (D:\Documents\GitHub\prism\node_modules\uglify-js\lib\parse.js:204:11)
    at parse_error (D:\Documents\GitHub\prism\node_modules\uglify-js\lib\parse.js:306:9)
    at Object.next_token [as input] (D:\Documents\GitHub\prism\node_modules\uglify-js\lib\parse.js:551:9)
    at next (D:\Documents\GitHub\prism\node_modules\uglify-js\lib\parse.js:649:25)
    at as_name (D:\Documents\GitHub\prism\node_modules\uglify-js\lib\parse.js:1259:9)
    at subscripts (D:\Documents\GitHub\prism\node_modules\uglify-js\lib\parse.js:1297:30)
    at expr_atom (D:\Documents\GitHub\prism\node_modules\uglify-js\lib\parse.js:1171:20)
    at maybe_unary (D:\Documents\GitHub\prism\node_modules\uglify-js\lib\parse.js:1334:19)
    at expr_ops (D:\Documents\GitHub\prism\node_modules\uglify-js\lib\parse.js:1369:24)
Emitted 'error' event at:
    at DestroyableTransform.onerror (D:\Documents\GitHub\prism\node_modules\gulp-replace\node_modules\readable-stream\lib\_stream_readable.js:640:52)
    at DestroyableTransform.emit (events.js:182:13)
    at onwriteError (D:\Documents\GitHub\prism\node_modules\gulp-uglify\node_modules\readable-stream\lib\_stream_writable.js:250:10)
    at onwrite (D:\Documents\GitHub\prism\node_modules\gulp-uglify\node_modules\readable-stream\lib\_stream_writable.js:268:5)
    at WritableState.onwrite (D:\Documents\GitHub\prism\node_modules\gulp-uglify\node_modules\readable-stream\lib\_stream_writable.js:106:5)
    at afterTransform (D:\Documents\GitHub\prism\node_modules\gulp-uglify\node_modules\readable-stream\lib\_stream_transform.js:104:5)
    at TransformState.afterTransform (D:\Documents\GitHub\prism\node_modules\gulp-uglify\node_modules\readable-stream\lib\_stream_transform.js:79:12)
    at DestroyableTransform.minify [as _transform] (D:\Documents\GitHub\prism\node_modules\gulp-uglify\index.js:55:11)
    at DestroyableTransform.Transform._read (D:\Documents\GitHub\prism\node_modules\gulp-uglify\node_modules\readable-stream\lib\_stream_transform.js:184:10)
    at DestroyableTransform.Transform._write (D:\Documents\GitHub\prism\node_modules\gulp-uglify\node_modules\readable-stream\lib\_stream_transform.js:172:12)

(Which task failed? Which file? Which line? Any hints as to what caused the error?)

into

... more gulp log ...
[15:10:42] 'components' errored after 864 ms
[15:10:42] Error in plugin 'gulp-uglify'
Message:
    Unexpected character '`'
Details:
    fileName: D:\Documents\GitHub\prism\components\prism-js-extras.js
    lineNumber: 67

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants