]> git.tdb.fi Git - libs/datafile.git/blobdiff - source/parser.cpp
Exception rework for parser components
[libs/datafile.git] / source / parser.cpp
index 99ece49a0375d57345cf1c905d4d395a37eeb167..443c3c8c3d72a4d0951e076f260b6262d511c25f 100644 (file)
@@ -1,5 +1,6 @@
 #include <msp/strings/format.h>
 #include "binaryparser.h"
+#include "dataerror.h"
 #include "parser.h"
 #include "statement.h"
 #include "textparser.h"
@@ -25,7 +26,7 @@ Parser::~Parser()
 Statement Parser::parse()
 {
        if(!good)
-               throw Exception("Parser is not good");
+               throw logic_error("Parser::parse() !good");
 
        try
        {
@@ -54,10 +55,13 @@ Statement Parser::parse()
                                return st;
                }
        }
-       catch(const Exception &e)
+       catch(const exception &e)
        {
                good = false;
-               throw;
+               if(dynamic_cast<const data_error *>(&e))
+                       throw;
+               else
+                       throw data_error(src, in.get_line_number(), e);
        }
 }