grunt
grunt copied to clipboard
Removed --stack option to always print stack traces for errors
I have seen so much frustration from grunt users not knowing about --stack. I don't see why you wouldn't want to see a stack trace when an error occurs.
:+1:
:+1:
+1 for Grunt v0.5 :)
FWIW, you can add grunt.option('stack', true); at the top of your gruntfile to have it always display now.
@shama it's easier to just alias grunt=grunt --stack, but most will know neither of these workarounds.
Exactly. The real issue is that we're getting tons of bug reports without
--stack turned on which causes an avoidable feedback loop.
Pascal Hartig Software Engineer
http://passy.me/ Twitter: https://twitter.com/passy Google+: http://gplus.to/passy
On Wed, Aug 7, 2013 at 9:55 AM, Sindre Sorhus [email protected]:
@shama https://github.com/shama it's easier to just alias grunt=grunt --stack, but most will know neither of these workarounds.
— Reply to this email directly or view it on GitHubhttps://github.com/gruntjs/grunt/pull/864#issuecomment-22235375 .
:+1:
So here's the problem. How do we know that an error is expected vs unexpected? For example, when a task fails, it's because an exception is thrown—and handled—but thrown nonetheless.

In fact, while you can return false; or done(false) inside a task to fail it, you can also throw new Error('...'); as well. How does Grunt differentiate between an expected and unexpected error?
I mean, I could maybe have it auto-dump a stack trace on ReferenceError but I don't want it to show a stack trace all the time.
Any suggestions?
One thought is to look @ the paths in the stack trace, and if any of them exist outside of Grunt or your project's node_modules folder, dump the stack trace automatically. Or something similar.
Looking for ideas here, thanks!
ping @adamstallard @passy @sindresorhus @ChrisWren @netroy ^
I'm stumped
In fact, while you can return false; or done(false) inside a task to fail it, you can also throw new Error('...'); as well. How does Grunt differentiate between an expected and unexpected error?
How about not letting grunt plugin authors throw errors to be caught by Grunt, instead they are forced to use grunt.fail.fatal or done(false)? If an error is throw it is assumed to be unexpected.
+1 forcing plugin authors to grunt.fail
you can also throw new Error('...'); as well
That should be an unexpected error and logged. Task authors should be encouraged to make a task fail properly without throwing exceptions.
Was that the only concern?
:+1:
:+1: