zenhob / hcl

Command-line tool for manipulating Harvest timesheets
http://zenhob.github.io/hcl
MIT License
223 stars 45 forks source link

Missing root element in XML results in stack trace #25

Closed zenhob closed 15 years ago

zenhob commented 15 years ago

I think this is masking another issue. In any case, when HCl gets XML input that it doesn't know what to do with, the correct response is not to freak out, like it does here:

/Library/Ruby/Gems/1.8/gems/zenhob-hcl-0.2.1/lib/hcl/task.rb:5:in cache_tasks': undefined methodelements' for nil:NilClass (NoMethodError)
from /Library/Ruby/Gems/1.8/gems/zenhob-hcl-0.2.1/lib/hcl/day_entry.rb:18:in `from_xml'
from /Library/Ruby/Gems/1.8/gems/zenhob-hcl-0.2.1/lib/hcl/day_entry.rb:9:in `all'
from /Library/Ruby/Gems/1.8/gems/zenhob-hcl-0.2.1/lib/hcl.rb:222:in `show'
from /Library/Ruby/Gems/1.8/gems/zenhob-hcl-0.2.1/lib/hcl.rb:44:in `send'
from /Library/Ruby/Gems/1.8/gems/zenhob-hcl-0.2.1/lib/hcl.rb:44:in `run'
from /Library/Ruby/Gems/1.8/gems/zenhob-hcl-0.2.1/lib/hcl.rb:38:in `command'
from /Library/Ruby/Gems/1.8/gems/zenhob-hcl-0.2.1/bin/hcl:6
from /usr/bin/hcl:19:in `load'
from /usr/bin/hcl:19

A good short-term solution would probably be to report a problem with the XML results. Not sure what else yet, or what the known workarounds are, if any.

Thanks radar for putting me on to this.

zenhob commented 15 years ago

2b7d0061e5b7c7a53a49e3d73b0af2397d991af6 has slightly improved error reporting.

zenhob commented 15 years ago

Closing since there's no longer a stack trace here. Will open a new issue if/when I see missing XML myself or get another bug report.