42#include "FileFinder.hpp"
43#include "PosixPathFixer.hpp"
44#include "GetCurrentWorkingDirectory.hpp"
47#if (PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR < 2 || PETSC_VERSION_MAJOR<3 )
48typedef PetscTruth PetscBool;
52 const std::string& rFilename,
unsigned lineNumber) : std::runtime_error(rMessage)
65 const std::string& rFilename,
unsigned lineNumber)
68 std::string filename(rFilename);
72 filename.replace(0,root_dir_length,
"./");
77 std::stringstream line_number_stream;
78 line_number_stream << lineNumber;
79 mMessage = std::string(
"\nChaste error: ") + posix_filename +
":" + line_number_stream.str() +
": " +
mShortMessage;
101 error =
"Incorrect exception message thrown: expected (" + rExpected +
"); got (" +
mShortMessage +
").";
109 if (
mShortMessage.find(rExpected) == std::string::npos &&
mShortMessage !=
"Another process threw an exception; bailing out.")
111 error =
"Incorrect exception message thrown: expected it to contain (" + rExpected +
"); got (" +
mShortMessage +
").";
119 std::stringstream error_message;
121 error_message <<
"\nChaste termination: " << rFilename <<
":" << lineNumber <<
": " << rMessage<<
"\n";
122 std::cerr << error_message.str();
129 PetscInitialized(&is_there);
132 MPI_Abort(PETSC_COMM_WORLD, EXIT_FAILURE);
const char * ChasteSourceRootDir()
static std::string ToPosix(const fs::path path)
std::string GetMessage() const
void SetMessage(const std::string &rMessage, const std::string &rFilename, unsigned lineNumber)
std::string mShortMessage
std::string CheckShortMessageContains(const std::string &rExpected) const
Exception(const std::string &rMessage, const std::string &rFilename, unsigned lineNumber)
static void Terminate(const std::string &rMessage, const std::string &rFilename, unsigned lineNumber)
virtual const char * what() const noexcept override
std::string GetShortMessage() const
std::string CheckShortMessage(const std::string &rExpected) const