GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
If a task for a guard throws an exception, the error is swallowed. This is fine, except that if you're developing a guard, all you get is an error message without an idea of where it occurred, which is not very helpful. This change prints the exception and its backtrace to the console before continuing.
One note about this is that I didn't know whether to print to stderr or use UI.error. I don't really know what the point of the UI module is -- since it resets colors, one would think that it prints colored messages also, but it doesn't do that, so I don't exactly see why it's being used. Feel free to change it to UI.error if that's what you really want, though.
If running a task for a guard and it borks, don't swallow the error b…
…ut print the backtrace
if it's for development purpose, I think the UI#debug method is appropriate. You would then launch guard in debug mode with guard -d (I've just seen that this option is not documented in the README!) to see more info on the exception.
Hmm. Yeah, UI.debug might make more sense. I could live with that.
Ok, I've merged the pull-request and finally used UI.error since I think it's always useful to see an Exception trace (not only during development). I've also added color (red) to the "ERROR:" flag when you use UI.error.