DEADSOFTWARE

Testing odcread against a bunch of existing .odc files
[odcread.git] / odcread.cc
index e790fdd36bcdc3b211d3c4d277cf9462ee6db3dd..858028e6babf5e252ede8ade0c0f71d2946ceb4e 100644 (file)
@@ -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;