Wang-Bioinformatics-Lab / ChemicalStructureWebService

Web Server for Chemical Structure pictures as well as other chemical structure things
https://structure.gnps2.org
MIT License
6 stars 2 forks source link

RDKit error handling #5

Closed jvansan closed 5 years ago

jvansan commented 5 years ago

The methods in views.py do not account for cases where RDKit raises an error rather than returns no mol object. Note, these are difficult to handle cases because the RDKit python bindings don't have the C++ errors that occur. In my experience, it necessary to handle these by catching TypeError exceptions.

I suggest either refactoring to call methods which have do exception handling, or to write a decorator which does this. I can do either of these if anyone has a preference.

mwang87 commented 5 years ago

I think in these cases because the functions are short and cannot be recovered from, a decorator would be better. Thanks for the help Jeff!