[MOAB-dev] commit/MOAB: danwu: Minor changes to SET_ERR macros.

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Tue Feb 18 16:33:12 CST 2014


1 new commit in MOAB:

https://bitbucket.org/fathomteam/moab/commits/2e34a553893c/
Changeset:   2e34a553893c
Branch:      error_handling_enhancement
User:        danwu
Date:        2014-02-18 23:32:57
Summary:     Minor changes to SET_ERR macros.

Affected #:  3 files

diff --git a/examples/TestErrorHandling.cpp b/examples/TestErrorHandling.cpp
index f7f3cc9..0ea0fa4 100644
--- a/examples/TestErrorHandling.cpp
+++ b/examples/TestErrorHandling.cpp
@@ -26,13 +26,13 @@ ErrorInfo FunctionC(int n)
   }
   else if (2 == n) {
     // Simulate MB_FILE_WRITE_ERROR
-    SET_ERR1(MB_FILE_WRITE_ERROR, "FunctionC() created a contrived error MB_FILE_WRITE_ERROR");
+    SET_ERR(MB_FILE_WRITE_ERROR, "FunctionC() created a contrived error MB_FILE_WRITE_ERROR");
   }
   else if (3 == n) {
     // Simulate MB_NOT_IMPLEMENTED
     ErrorInfo err_info(MB_NOT_IMPLEMENTED);
     err_info << "n = " << n << ", FunctionC() created a contrived error MB_NOT_IMPLEMENTED (this message is built with C++ streaming)";
-    SET_ERR(err_info);
+    SET_ERR1(err_info);
   }
 
   return ERROR_INFO_SUCCESS;

diff --git a/examples/TestErrorHandlingPar.cpp b/examples/TestErrorHandlingPar.cpp
index 99f9c9f..5245349 100644
--- a/examples/TestErrorHandlingPar.cpp
+++ b/examples/TestErrorHandlingPar.cpp
@@ -20,7 +20,7 @@ ErrorInfo FunctionC(int rank)
   // Simulate MB_FILE_WRITE_ERROR
   ErrorInfo err_info(MB_FILE_WRITE_ERROR);
   err_info << "FunctionC() created a contrived error MB_FILE_WRITE_ERROR in processor " << rank;
-  SET_ERR(err_info);
+  SET_ERR1(err_info);
 
   return ERROR_INFO_SUCCESS;
 }

diff --git a/src/moab/ErrorHandler.hpp b/src/moab/ErrorHandler.hpp
index f387f29..99f6daa 100644
--- a/src/moab/ErrorHandler.hpp
+++ b/src/moab/ErrorHandler.hpp
@@ -118,11 +118,16 @@ ErrorCode MBError(int line, const char* func, const char* file, const char* dir,
 #endif
 
 #ifdef USE_ERROR_INFO_CLASS
-#define SET_ERR(err_info) \
+#define SET_ERR(err_code, err_msg) \
+  return MBError(__LINE__, __func__, __FILENAME__, __SDIR__, ErrorInfo(err_code, err_msg), MB_ERROR_TYPE_NEW)
+
+#define SET_ERR1(err_info) \
   return MBError(__LINE__, __func__, __FILENAME__, __SDIR__, err_info, MB_ERROR_TYPE_NEW)
 
-#define SET_ERR1(err_code, err_msg) \
-  return MBError(__LINE__, __func__, __FILENAME__, __SDIR__, ErrorInfo(err_code, err_msg), MB_ERROR_TYPE_NEW)
+#define SET_ERR_STR(err_code, err_msg_str) \
+  ErrorInfo err_info; \
+  err_info << err_msg_str; \
+  return MBError(__LINE__, __func__, __FILENAME__, __SDIR__, err_info, MB_ERROR_TYPE_NEW)
 
 #define CHK_ERR(err_info) \
   do { \

Repository URL: https://bitbucket.org/fathomteam/moab/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.


More information about the moab-dev mailing list