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)
69 std::string filename(rFilename);
73 filename.replace(0,root_dir_length,
"./");
78 std::stringstream line_number_stream;
79 line_number_stream << lineNumber;
80 mMessage = std::string(
"\nChaste error: ") + posix_filename +
":" + line_number_stream.str() +
": " +
mShortMessage;
98 error =
"Incorrect exception message thrown: expected (" + expected +
"); got (" +
mShortMessage +
").";
108 error =
"Incorrect exception message thrown: expected it to contain (" + expected +
"); got (" +
mShortMessage +
").";
116 std::stringstream error_message;
118 error_message <<
"\nChaste termination: " << rFilename <<
":" << lineNumber <<
": " << rMessage<<
"\n";
119 std::cerr << error_message.str();
126 PetscInitialized(&is_there);
129 MPI_Abort(PETSC_COMM_WORLD, EXIT_FAILURE);
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