CDK-R / cdkr

Integrating R and the CDK
https://cdk-r.github.io/cdkr/
42 stars 27 forks source link

Poor error message for invalid smiles in rinchi #68

Closed sneumann closed 7 months ago

sneumann commented 6 years ago

Hi, we get a not so informative error message when passing crap into get.inchi()

> get.inchi("x")
Error in .jcall("org/guha/rcdk/util/Misc", "S", "getInChi", molecule,  : 
  method getInChi with signature ()Ljava/lang/String; not found

It would be better to throw a better error message invalid SMILES back to R. Yours, Steffen

schymane commented 6 years ago

I put tryCatch when using a lot of these functions to print out an error for myself because sometimes the java message is actually helpful to find the cause of the problem (I am not sure in this case if you’d get different ones). It’s quite hard to detect whether it’s an invalid SMILES or just one that can’t be processed properly and hence you can get a variety of causes and may be able to go through some options. Some of this has changed in the newer rcdk versions and I’ve not updated all my old functions yet :-)