More refactoring for c++ wrapper (readout with std::exception)