Closed tenzinhl closed 1 year ago
I was originally going to write a PR to make this suggested change, but since I'm a new user to OpenCRAVAT (and thus even greener of a dev) wasn't sure what other side effects it'd have.
Hi tenzinhl. Thanks for the detailed digging here. I agree with letting exceptions bubble up from get_file_to_string
, and handling them at a higher level. Catching everything into a return ""
is icky. I have to read through the code a bit to see what the consequences are though.
If you'd like, we could split this up where you send in a PR that changes get_file_to_string
to properly elevate exceptions, and I can fix the calling code.
Open to any suggestions you have.
Hey! Sorry for the late update. PR is open now: https://github.com/KarchinLab/open-cravat/pull/123
Not many changes there, just has the exception bubble up. Places where the method is called will probably need to be modified for the new contract.
Added a couple comments to the pr
The PR. Along with commits 36e514b6a48ca080e28ebb7e7df6febbb2523378 and d711d154bb0f7632399c3648ad627067b7786ffd should fix this issue. They also improve oc's handling for fatal exceptions.
Currently
store_utils.get_file_to_string()
has a catch allexcept:
clause that just returns an empty string when something went wrong with the request. This hid the true nature of the issue when I was running into issues trying to runoc module install-base
, which was a simple SSL verification failure due to not having registered the proper certs with therequests
library in the docker container.The interaction that kind of misled me was in
admin_util.ModuleInfoCache.update_remote()
where all the message says is "please check internet connection", which was not my issue (and for many possible exceptions raised byrequests
not the issue either).I would suggest removing the
try-catch
and just letting any raised exceptions be handled by the calling code. At the very least when it goes unhandled the exception (at least in my case) would have more useful information for debugging the issue.Understandably this method is called in more than just one spot though, so curious what others' thoughts are on this. I quickly looked for where this function is called and there aren't too many sites.