43#include "FileFinder.hpp"
44#include "PosixPathFixer.hpp"
45#include "GetCurrentWorkingDirectory.hpp"
47#include "PosixPathFixer.hpp"
49#if (PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR < 2 || PETSC_VERSION_MAJOR<3 )
50typedef PetscTruth PetscBool;
54 const std::string& rFilename,
unsigned lineNumber) : std::runtime_error(rMessage)
67 const std::string& rFilename,
unsigned lineNumber)
70 std::string filename(rFilename);
74 filename.replace(0,root_dir_length,
"./");
79 std::stringstream line_number_stream;
80 line_number_stream << lineNumber;
81 mMessage = std::string(
"\nChaste error: ") + posix_filename +
":" + line_number_stream.str() +
": " +
mShortMessage;
103 error =
"Incorrect exception message thrown: expected (" + rExpected +
"); got (" +
mShortMessage +
").";
111 if (
mShortMessage.find(rExpected) == std::string::npos &&
mShortMessage !=
"Another process threw an exception; bailing out.")
113 error =
"Incorrect exception message thrown: expected it to contain (" + rExpected +
"); got (" +
mShortMessage +
").";
121 std::stringstream error_message;
123 error_message <<
"\nChaste termination: " << rFilename <<
":" << lineNumber <<
": " << rMessage<<
"\n";
124 std::cerr << error_message.str();
131 PetscInitialized(&is_there);
134 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