Hi,

I have now managed to produce a nice little self-contained DLL that uses RDKit to do substructure mapping. It receives a query and a target molecule as two MDL molfile strings. When the inputs are valid it behaves well and returns the atom mapping to me. Yes :-).

However, when I give it an invalid MDL molfile as input, e.g. a text file with regular prose, MolDataStreamToMol() throws a highly unexpected error message.

This piece of my test code:

    ifstream query_file ("C:\\SubstructData\\results.txt");

    auto_ptr<RWMol> query (NULL);
    unsigned int line = 0;

    try {
query.reset( MolDataStreamToMol(query_file, line, false, false, false) );
    } catch (std::exception& e) {
        cout << "STD-ERROR: " << e.what() << endl;
        return 1;
    } catch (...) {
        cout << "UNK-ERROR: Unknown exception." << endl;
        return 1;
    }

produces this output:

   [00:13:24] CTAB version string invalid at line 4
   STD-ERROR: *Unknown exception*

In MolFileParser.cpp line 1881 I can locate the reported error message:

        std::ostringstream errout;
        errout<<"*CTAB version string invalid at line* "<<line;
        if(strictParsing){
          if(res) delete res;
          throw FileParseException(errout.str());
        } else {
*          BOOST_LOG(rdWarningLog) << errout.str() << std::endl;*
        }

Since I run with strictParsing==false the BOOST_LOG(rdWarningLog) call must be the one that emits the first line of output, and I assume that the boost warning log does not throw an exception. I haven't been able to figure out where the exception gets thrown, but that must be later in the code.

If I switch to strict parsing (last parameter in MolDataStreamToMol() set to true) I don't see the boost log message anymore, only the single line "STD-ERROR: Unknown exception". So strict parsing actually yields less error message context.

I hope the exception error message can be changed to something more meaningful ?

Cheers
-- Jan
------------------------------------------------------------------------------
Got visibility?
Most devs has no idea what their production app looks like.
Find out how fast your code is with AppDynamics Lite.
http://ad.doubleclick.net/clk;262219671;13503038;y?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to