43 #include "FileFinder.hpp"
44 #include "PosixPathFixer.hpp"
45 #include "GetCurrentWorkingDirectory.hpp"
48 #if (PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR < 2 || PETSC_VERSION_MAJOR<3 ) // Before PETSc 3.2
53 const std::string& rFilename,
unsigned lineNumber)
66 const std::string& rFilename,
unsigned lineNumber)
71 #define COVERAGE_IGNORE
72 std::string filename(rFilename);
76 filename.replace(0,root_dir_length,
"./");
78 #undef COVERAGE_IGNORE
82 std::stringstream line_number_stream;
83 line_number_stream << lineNumber;
84 mMessage = std::string(
"\nChaste error: ") + posix_filename +
":" + line_number_stream.str() +
": " +
mShortMessage;
102 error =
"Incorrect exception message thrown: expected (" + expected +
"); got (" +
mShortMessage +
").";
112 error =
"Incorrect exception message thrown: expected it to contain (" + expected +
"); got (" +
mShortMessage +
").";
117 #define COVERAGE_IGNORE //Termination NEVER EVER happens under normal testing conditions.
120 std::stringstream error_message;
122 error_message <<
"\nChaste termination: " << rFilename <<
":" << lineNumber <<
": " << rMessage<<
"\n";
123 std::cerr << error_message.str();
130 PetscInitialized(&is_there);
133 MPI_Abort(PETSC_COMM_WORLD, EXIT_FAILURE);
141 #undef COVERAGE_IGNORE // Termination NEVER EVER happens under normal testing conditions
const char * ChasteSourceRootDir()
std::string CheckShortMessage(std::string expected) const
Exception(const std::string &rMessage, const std::string &rFilename, unsigned lineNumber)
void SetMessage(const std::string &rMessage, const std::string &rFilename, unsigned lineNumber)
std::string GetMessage() const
static std::string ToPosix(const fs::path path)
static void Terminate(const std::string &rMessage, const std::string &rFilename, unsigned lineNumber)
std::string mShortMessage
std::string CheckShortMessageContains(std::string expected) const
std::string GetShortMessage() const