[MOAB-dev] r1273 - MOAB/trunk/tools/converter

kraftche at mcs.anl.gov kraftche at mcs.anl.gov
Fri Sep 14 11:01:06 CDT 2007


Author: kraftche
Date: 2007-09-14 11:01:06 -0500 (Fri, 14 Sep 2007)
New Revision: 1273

Modified:
   MOAB/trunk/tools/converter/convert.cpp
Log:
print last reported error message if file read or write files

Modified: MOAB/trunk/tools/converter/convert.cpp
===================================================================
--- MOAB/trunk/tools/converter/convert.cpp	2007-09-13 16:13:20 UTC (rev 1272)
+++ MOAB/trunk/tools/converter/convert.cpp	2007-09-14 16:01:06 UTC (rev 1273)
@@ -268,7 +268,11 @@
   result = gMB->load_file( in, read_meshset, read_options.c_str() );
   if (MB_SUCCESS != result)
   { 
-    std::cerr << "Failed to load \"" << in << "\"." << std::endl; 
+    std::cerr << "Failed to load \"" << in << "\"." << std::endl;
+    std::cerr  << "Error code: " << gMB->get_error_string(result) << " (" << result << ")" << std::endl;
+    std::string message;
+    if (MB_SUCCESS == gMB->get_last_error(message) && !message.empty())
+      std::cerr << "Error message: " << message << std::endl;
     return READ_ERROR;
   }
   std::cerr << "Read \"" << in << "\"" << std::endl;
@@ -492,6 +496,10 @@
   if (MB_SUCCESS != result)
   { 
     std::cerr << "Failed to write \"" << out << "\"." << std::endl; 
+    std::cerr  << "Error code: " << gMB->get_error_string(result) << " (" << result << ")" << std::endl;
+    std::string message;
+    if (MB_SUCCESS == gMB->get_last_error(message) && !message.empty())
+      std::cerr << "Error message: " << message << std::endl;
     return WRITE_ERROR;
   }
   std::cerr << "Wrote \"" << out << "\"" << std::endl;




More information about the moab-dev mailing list