Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

errors when loading Thorfiles do not include stacktrace #36

Closed
technicalpickles opened this issue Apr 7, 2010 · 6 comments
Closed

errors when loading Thorfiles do not include stacktrace #36

technicalpickles opened this issue Apr 7, 2010 · 6 comments

Comments

@technicalpickles
Copy link

Whenever errors/exceptions are encountered, only the error's type and message are displayed, excluding any sort of line information. For example, I had an uninitialized constant because I forgot to do a require, and I get this message:

WARNING: unable to load thorfile "/Users/technicalpickles/code/active/bedazzle/Thorfile": uninitialized constant Bedazzle::Build

I probably figure out this one just by looking at the code in Thorfile, but sometimes the error originates from code outside the code, and then it's basically impossible to debug.

It's a pretty easy fix to change thor to raise the error instead of putsing it. But the question remains, would this be acceptable for thor to do?

@technicalpickles
Copy link
Author

Fixed in in my fork at technicalpickles/thor@f85c87b. I ended up just doing a puts of the error's backtrace.

@eventualbuddha
Copy link
Contributor

I think it's probably acceptable, but I'm hesitant to change it. If I were fixing it myself I'd probably either show the top line of the stack trace or print the whole thing out to a log file.

@technicalpickles
Copy link
Author

The top line of the backtrace wouldn't be sufficient in a lot of cases, I think. It's only useful if the error comes from a line in the Thorfile.

Logging it would be better, but I think it's a little overkill. If you're working on a thorfile in the current directory, and you are trying to call tasks defined in it, I really want to see backtraces that happened, and not have to know that there's an error log somewhere, and then actually open the file.

@eventualbuddha
Copy link
Contributor

Fwiw, I believe this was added to prevent misbehaving global Thor helpers from always bombing Thor out. Do you guys have any thoughts on making that case usable/not horrible?

@josevalim
Copy link
Contributor

Yeah, it was added to prevent thor from exploding due to some bad files. Showing the whole backtrace would be cumbersome, +1 for showing just the first line. You can invoke thor path/to/faulty/Thorfile --debug to get the whole error (at least I hope so).

@eventualbuddha
Copy link
Contributor

I did what josevalim suggested. Find the commit here.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants