X-Git-Url: https://deadsoftware.ru/gitweb?p=odcread.git;a=blobdiff_plain;f=odcread.cc;h=858028e6babf5e252ede8ade0c0f71d2946ceb4e;hp=e790fdd36bcdc3b211d3c4d277cf9462ee6db3dd;hb=41d9c65ec79728a8771cd2288dfc3458569c6801;hpb=20254ed23eb75d8c3832b807ea97616fd684976e diff --git a/odcread.cc b/odcread.cc index e790fdd..858028e 100644 --- a/odcread.cc +++ b/odcread.cc @@ -113,12 +113,27 @@ int main(int argc, char *argv[]) { return 1; } std::ifstream in(argv[1], std::ios::in | std::ios::binary); - odc::Store* s = odc::importDocument(in); + + odc::Store* s; + try { + s = odc::importDocument(in); + } catch (int trap) { + std::cerr << "Exception in parsing file: BlackBox trap no. " << trap << std::endl; + return 2; + } catch (const char * exception) { + std::cerr << "Exception in parsing file: " << exception << std::endl; + return 2; + } // std::cout << s->toPlainText() << std::endl; // std::cout << std::endl << std::endl; - odc::MyVisitor visitor; - s->accept(visitor); + try { + odc::MyVisitor visitor; + s->accept(visitor); + } catch (const char * exception) { + std::cerr << "Exception in processing document: " << exception << std::endl; + return 3; + } // std::cout << s->toString() << std::endl; // std::cout << in.tellg() << " " << in.eof() << std::endl;