Salome HOME
Deleted deprecated code
[modules/yacs.git] / src / yacsloader / parsers.cxx
index 513dd1efc67fb2a3d09d8e9bc01e227aca132da6..5ed11d87f6819347ea9fb0876900bf0dbfe398c2 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2006-2015  CEA/DEN, EDF R&D
+// Copyright (C) 2006-2016  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -124,6 +124,8 @@ ENGINE::Proc* YACSLoader::load(const char * file)
   {
     if ( xmlParseDocument(saxContext) == -1 )
     {
+      if(!currentProc)
+        throw Exception("Basic error during parsing.");
       YACS::ENGINE::Logger* logger = currentProc->getLogger("parser");
       logger->fatal( saxContext->lastError.message, file, saxContext->input->line );
     }
@@ -132,6 +134,8 @@ ENGINE::Proc* YACSLoader::load(const char * file)
   }
   catch(Exception& e)
   {
+    if(!currentProc)
+      throw e;
     YACS::ENGINE::Logger* logger = currentProc->getLogger("parser");
     logger->fatal(e.what(), file, saxContext->input->line);
     saxContext = 0;