-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Improve error messages on exit #587
Comments
Stacktraces will be handled with the BetterError module I'm working on right now, which should make them look a lot better and allow for easier filtering + visualization of async operations. Why pass a number to done instead of just passing an error? |
Awesome! If you've got any WIP / design docs to share I would definitively have a look.
This is due to the fact that some 3rd party libraries are taking callbacks to signal their async processing completion. In this particular case I was bridging Karma-runner with gulp (full repo here: https://github.com/karma-runner/gulp-karma): var karma = require('karma').server;
gulp.task('test', function (done) {
karma.start({}, done);
}); As you can see I'm directly passing gulp's gulp.task('test', function (done) {
karma.start({}, function(exitStatus){
done(exitStatus ? "There are failing unit tests" : undefined);
});
}); but yeh, this is more verbose and not really needed as Karma already provides good info about the run status / failed tests. So, this is real-life scenario and IMO it wouldn't hurt to handle strings and numbers the same way. |
Can you test out the code on master and see if it works for you? The stack traces are still fucked but that's being handled in gulp 4 |
Yup, this seems consistent now, thnx @contra |
I wonder how we could improve error messages when a task signals an error in a callback. Consider this convoluted (but illustrating the point) task:
With the above code snippet the exit code / stack trace is nice and all is well:
The problem
I supply the
done
callback with a string (done('fail')
) I'm getting a looongish stack trace from the gulp CLI which is rather verbose and hard to read:It has all the necessary info but yeh, people will be probably confused by seeing orchestrator / gulp as part of the stack-trace. Maybe it would make sense to filter out part of the internal Gulp stack-frames?
Special case for numbers
If a non-zero number is supplied to the
done
callback (ex.done(1)
), which is a real life scenario from gulp-karma integration (https://github.com/karma-runner/gulp-karma/blob/master/gulpfile.js#L20) we are getting:which should be fixed, IMO, as
undefined
looks like something is internally broken.The proposal
Based on the above, here are my suggestions:
Would be happy to put together a PR if the above reasoning makes sense to you guys.
Related to this commit: aeaebd9
The text was updated successfully, but these errors were encountered: