Commits

Sam Adams committed b8d0892

Added check for InChI generation

Comments (0)

Files changed (1)

chemistry-common/src/main/java/uk/ac/cam/ch/wwmm/chempound/chemistry/inchi/InchiTool.java

         try {
             JniInchiInput input = getInchiInput(molecule, options);
             JniInchiOutput output = JniInchiWrapper.getInchi(input);
-            return output.getInchi();
+            if (output.getReturnStatus() == INCHI_RET.OKAY) {
+                return output.getInchi();
+            }
+            if (output.getReturnStatus() == INCHI_RET.WARNING) {
+                LOG.warn("Warning generating InChI: "+output.getMessage());
+                return output.getInchi();
+            }
+            throw new RuntimeException("Error generating InChI: "+output.getMessage());
         } catch (JniInchiException e) {
             throw new RuntimeException(e);
         }