From 1453bdba44d1fad140559c6de32a30c1d4488b16 Mon Sep 17 00:00:00 2001
From: William F Godoy <williamfgc@yahoo.com>
Date: Tue, 6 Jun 2017 13:42:39 -0400
Subject: [PATCH] Fixing DataMan reader and adding Engine creation exception

---
 examples/hello/datamanReader/helloDataManReader.cpp |  4 ++--
 source/adios2/core/IO.cpp                           | 11 +++++++++++
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/examples/hello/datamanReader/helloDataManReader.cpp b/examples/hello/datamanReader/helloDataManReader.cpp
index c830d16f4..7dc984af3 100644
--- a/examples/hello/datamanReader/helloDataManReader.cpp
+++ b/examples/hello/datamanReader/helloDataManReader.cpp
@@ -42,13 +42,13 @@ int main(int argc, char *argv[])
         adios::ADIOS adios(adios::DebugON);
 
         adios::IO &dataManIO = adios.DeclareIO("WAN");
-        dataManIO.SetEngine("DataMan");
+        dataManIO.SetEngine("DataManReader");
         dataManIO.SetParameters("real_time=yes", "method_type=stream",
                                 "method=dump");
         auto dataManReader =
             dataManIO.Open("myDoubles.bp", adios::OpenMode::Read);
 
-        if (dataManReader == nullptr)
+        if (!dataManReader)
         {
             throw std::ios_base::failure(
                 "ERROR: failed to create DataMan I/O engine at Open\n");
diff --git a/source/adios2/core/IO.cpp b/source/adios2/core/IO.cpp
index 8d3339a33..a9753acc3 100644
--- a/source/adios2/core/IO.cpp
+++ b/source/adios2/core/IO.cpp
@@ -198,6 +198,17 @@ std::shared_ptr<Engine> IO::Open(const std::string &name,
                                     "HDF5 library, can't use HDF5\n");
 #endif
     }
+    else
+    {
+        if (m_DebugMode)
+        {
+            throw std::invalid_argument("ERROR: engine " + m_EngineType +
+                                        " not supported, IO SetEngine must add "
+                                        "a supported engine, in call to "
+                                        "Open\n");
+        }
+    }
+
     return engine;
 }
 
-- 
GitLab