cldwalker / boson

A command/task framework similar to rake and thor built with extendability in mind.
http://rdoc.info/gems/boson
MIT License
218 stars 10 forks source link

Why backtrace is not displayed on uncaught exception ? #18

Closed martinos closed 14 years ago

martinos commented 14 years ago

I would like to know why backtrace is removed on uncaught exception ?

In my case, when I get some uncaught exception I have not enough information to debug. I can then run the commands with the --verbose options. But sometimes the state of the system is not the same and I don't get any information.

So I always have to run the commands with the --verbose option which always adds debugging information which is not always .

I know that rake does the same thing but I never understood why. There is probably a reason but I can't figure it out.

cldwalker commented 14 years ago

I'm not sure I understand the issue. When you use the --verbose flag are you getting an incorrect backtrace? If so I'll need a specific example command to look into. When I use the flag in 1.8.7 or 1.9.x I get the backtrace right up to where the exception occurs.

If you want to run boson with --verbose flag always on, you could always alias boson i.e. in your .bashrc: alias boson='boson --verbose'. As for rake and boson , they have debug turned off by default because they assume most people are consumers of commands i.e. they're not authors and thus don't care why commands are failing.

martinos commented 14 years ago

Another big problem that I have is that some of my tasks takes long time to run (about 6 hours). When an error happens I have no clue about the error so I need to rerun the tasks for 6 hours with the --verbose switch on. I loose a lot of time.

It's not all tasks that can be run twice (with the verbose option set). Sometimes the system is not in the same state than when the command was called first. So It might be impossible to get enough information to debug.

If I always run my commands with the --verbose, I will always display information that is unwanted even in the case that the process don't fail.

If the consumers (which I imagine are 95% ruby programmers) have the backtrace, it would be easier for them debug the commands by themselves. In my case I have some consumers that are not ruby programmers, when have an error with my commands they don't have any information to send me. Then I can't help them. If they would have the full backtrace I just would have to ask them to send me the output of the command by email and voila.

I would like to emphasize they are uncaught exceptions, they should not happen, that's why I think that they should be displayed. So that the programmer could fix it so that the consumer would not see them anymore. I think that uncaught exception should stay uncaught and should be handled like every ruby process.

At my opinion hiding backtrace I only for cosmetic issue, which can have a lot of drawbacks (in my case it does).

That being said, I want you to know that boson helps me a lot in my day to day job and I really appreciate the work that you have done.

cldwalker commented 14 years ago

Ended up adding a backtrace option which will do what you want. You'll need to alias boson i.e. alias boson='boson --backtrace'. Glad boson helps you with your day to day job.

cldwalker commented 14 years ago

add commandline backtrace option, closed by 4c4c545052eda73848825d9eba00a99daf8cd275