grunt icon indicating copy to clipboard operation
grunt copied to clipboard

Removed --stack option to always print stack traces for errors

Open ChrisWren opened this issue 12 years ago • 16 comments
trafficstars

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.

ChrisWren avatar Aug 03 '13 03:08 ChrisWren

:+1:

sindresorhus avatar Aug 03 '13 16:08 sindresorhus

:+1:

passy avatar Aug 03 '13 19:08 passy

+1 for Grunt v0.5 :)

shama avatar Aug 04 '13 02:08 shama

FWIW, you can add grunt.option('stack', true); at the top of your gruntfile to have it always display now.

shama avatar Aug 06 '13 15:08 shama

@shama it's easier to just alias grunt=grunt --stack, but most will know neither of these workarounds.

sindresorhus avatar Aug 07 '13 07:08 sindresorhus

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 .

passy avatar Aug 07 '13 11:08 passy

:+1:

adamstallard avatar Aug 19 '13 17:08 adamstallard

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?

cowboy avatar Sep 18 '13 22:09 cowboy

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!

cowboy avatar Sep 18 '13 22:09 cowboy

ping @adamstallard @passy @sindresorhus @ChrisWren @netroy ^

vladikoff avatar Oct 30 '13 17:10 vladikoff

I'm stumped

sindresorhus avatar Oct 30 '13 19:10 sindresorhus

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.

ChrisWren avatar Oct 30 '13 21:10 ChrisWren

+1 forcing plugin authors to grunt.fail

bevacqua avatar Nov 22 '13 05:11 bevacqua

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?

jzaefferer avatar Jan 30 '14 11:01 jzaefferer

:+1:

ralphtheninja avatar Nov 18 '14 09:11 ralphtheninja

:+1:

cvrebert avatar Nov 18 '14 17:11 cvrebert