[MOAB-dev] commit/MOAB: danwu: Minor changes to src/ErrorHandler.cpp and error handling examples.
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Wed Feb 5 14:10:47 CST 2014
1 new commit in MOAB:
https://bitbucket.org/fathomteam/moab/commits/4a2091940a8d/
Changeset: 4a2091940a8d
Branch: error_handling_enhancement
User: danwu
Date: 2014-02-05 21:10:34
Summary: Minor changes to src/ErrorHandler.cpp and error handling examples.
Affected #: 4 files
diff --git a/examples/TestErrorHandling.cpp b/examples/TestErrorHandling.cpp
index 44f76d9..79901c5 100644
--- a/examples/TestErrorHandling.cpp
+++ b/examples/TestErrorHandling.cpp
@@ -5,7 +5,7 @@
* To run: ./TestErrorHandling \n
*/
-#include "moab/Core.hpp"
+#include "moab/Core.hpp" // Note, moab::Core is not used in this example
#include <iostream>
using namespace moab;
@@ -20,12 +20,12 @@ 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_ERR1(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 MB_NOT_IMPLEMENTED (this message is built with C++ streaming)";
+ err_info << "n = " << n << ", FunctionC() created a contrived MB_NOT_IMPLEMENTED (this message is built with C++ streaming)";
SET_ERR(err_info);
}
@@ -49,7 +49,7 @@ ErrorInfo FunctionA(int n)
// In this test case, no error occurs in the call hierarchy
ErrorInfo TestErrorHandling_1()
{
- ErrorInfo err_code = FunctionA(1);CHK_ERR(err_code);
+ ErrorInfo err_info = FunctionA(1);CHK_ERR(err_info);
return ERROR_INFO_SUCCESS;
}
@@ -57,7 +57,7 @@ ErrorInfo TestErrorHandling_1()
// In this test case, MB_FILE_WRITE_ERROR is returned by FunctionC
ErrorInfo TestErrorHandling_2()
{
- ErrorInfo err_code = FunctionA(2);CHK_ERR(err_code);
+ ErrorInfo err_info = FunctionA(2);CHK_ERR(err_info);
return ERROR_INFO_SUCCESS;
}
@@ -66,7 +66,7 @@ ErrorInfo TestErrorHandling_2()
// The error message is built with C++ streaming
ErrorInfo TestErrorHandling_3()
{
- ErrorInfo err_code = FunctionA(3);CHK_ERR(err_code);
+ ErrorInfo err_info = FunctionA(3);CHK_ERR(err_info);
return ERROR_INFO_SUCCESS;
}
diff --git a/examples/TestErrorHandlingPar.cpp b/examples/TestErrorHandlingPar.cpp
index 09287ed..a9bc4d8 100644
--- a/examples/TestErrorHandlingPar.cpp
+++ b/examples/TestErrorHandlingPar.cpp
@@ -5,7 +5,7 @@
* <b>To run</b>: mpiexec -np 4 ./TestErrorHandlingPar \n
*/
-#include "moab/Core.hpp"
+#include "moab/Core.hpp" // Note, moab::Core is not used in this example
#ifdef USE_MPI
#include "moab_mpi.h"
@@ -18,7 +18,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;
+ err_info << "FunctionC() created a contrived error MB_FILE_WRITE_ERROR in processor " << rank;
SET_ERR(err_info);
return ERROR_INFO_SUCCESS;
@@ -41,7 +41,7 @@ ErrorInfo FunctionA(int rank)
// In this test case, MB_FILE_WRITE_ERROR is returned by FunctionC in each processor
ErrorInfo TestErrorHandlingPar(int rank)
{
- ErrorInfo err_code = FunctionA(rank);CHK_ERR(err_code);
+ ErrorInfo err_info = FunctionA(rank);CHK_ERR(err_info);
return ERROR_INFO_SUCCESS;
}
diff --git a/examples/makefile b/examples/makefile
index c2d13cb..e52043b 100644
--- a/examples/makefile
+++ b/examples/makefile
@@ -7,8 +7,10 @@ include ${MOAB_DIR}/lib/iMesh-Defs.inc
# MESH_DIR is the directory containing mesh files that come with MOAB source
MESH_DIR="../MeshFiles/unittest"
+MOAB_CPPFLAGS += -DLOCDIR=examples/
+
EXAMPLES = HelloMOAB GetEntities SetsNTags StructuredMeshSimple DirectAccessWithHoles DirectAccessNoHoles TestErrorHandling
-PAREXAMPLES = HelloParMOAB ReduceExchangeTags LloydRelaxation
+PAREXAMPLES = HelloParMOAB ReduceExchangeTags LloydRelaxation TestErrorHandlingPar
F90EXAMPLES = DirectAccessNoHolesF90 PushParMeshIntoMoabF90
EXOIIEXAMPLES = TestExodusII
diff --git a/src/ErrorHandler.cpp b/src/ErrorHandler.cpp
index 45a8cea..6754b7e 100644
--- a/src/ErrorHandler.cpp
+++ b/src/ErrorHandler.cpp
@@ -40,7 +40,7 @@ void MBTraceBackErrorHandler(int line, const char* func, const char* file, const
// Print a line of stack trace
if (NULL != errorOutput)
- errorOutput->printf("%s() line %d in file %s%s\n", func, line, dir, file);
+ errorOutput->printf("%s() line %d in %s%s\n", func, line, dir, file);
}
ErrorInfo MBError(int line, const char* func, const char* file, const char* dir, const ErrorInfo& err_info, ErrorType err_type)
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