20 #ifndef LIBMESH_LIBMESH_EXCEPTIONS_H
21 #define LIBMESH_LIBMESH_EXCEPTIONS_H
23 #include "libmesh/libmesh_config.h"
38 LogicError() : std::logic_error(
"Error in libMesh internal logic" ) {}
39 LogicError(
const std::string & msg) : std::logic_error( msg ) {}
51 NotImplemented(std::string msg=
"") : std::logic_error(
"Error: feature not implemented!\n" + msg ) {}
65 FileError(
const std::string & filename,
const std::string msg=
"") :
66 std::runtime_error(
"Error with file `" + filename +
"'\n" + std::move(msg)) {}
112 std::ostringstream oss;
113 oss <<
"Error code " <<
error_code <<
" during solve." << std::endl;
125 virtual const char *
what() const noexcept
override
145 #ifdef LIBMESH_ENABLE_EXCEPTIONS
146 #define libmesh_noexcept noexcept
148 #define LIBMESH_THROW(e) do { throw e; } while (0)
149 #define libmesh_try try
150 #define libmesh_catch(e) catch(e)
154 #define LIBMESH_THROW(e) do { libMesh::err << e.what(); std::abort(); } while (0)
156 #define libmesh_catch(e) if (0)
158 #endif // LIBMESH_ENABLE_EXCEPTIONS
160 #endif // LIBMESH_LIBMESH_EXCEPTIONS_H
A class to stub for features that should be in libMesh, but haven't been written yet, to be thrown by "libmesh_not_implemented();".
NotImplemented(std::string msg="")
A class representing that a dynamic cast failed to produce expected output.
SolverException(int error_code_in)
int error_code
The error code generated by the solver.
A class representing a floating point exception.
std::string what_message
string which holds the message built in the constructor.
A class representing an exception during a solve.
LogicError(const std::string &msg)
FileError(const std::string &filename, const std::string msg="")
A class to represent the internal "this should never happen" errors, to be thrown by "libmesh_error()...
A class representing a solver's failure to converge, to be thrown by "libmesh_convergence_failure();"...
virtual ~SolverException()=default
Virtual destructor, gotta have one of those.
A class representing a failed attempt by the library to open a file (or construct an fstream...
virtual const char * what() const noexceptoverride
Override the what() function to provide a generic error message.