20#ifndef LIBMESH_LIBMESH_EXCEPTIONS_H
21#define LIBMESH_LIBMESH_EXCEPTIONS_H
23#include "libmesh/libmesh_config.h"
25#include "libmesh/libmesh_abort.h"
81 NotImplemented(std::string msg=
"") :
std::logic_error(
"Error: feature not implemented!\n" + msg ) {}
95 FileError(
const std::string & filename,
const std::string msg=
"") :
96 std::runtime_error(
"Error with file `" + filename +
"'\n" +
std::move(msg)) {}
120 std::runtime_error(
"Degenerate map, e.g. negative Jacobian or singular matrix.\n" + msg ) {}
134 ConvergenceFailure(
const std::string & err_msg=
"Unrecoverable failure to converge") :
std::runtime_error( err_msg ) {}
166 std::ostringstream oss;
167 oss <<
"Error code " <<
error_code <<
" during solve." << std::endl;
179 virtual const char *
what() const noexcept
override
212 const char *
what() const noexcept {
return "libMesh termination requested"; }
217#ifdef LIBMESH_ENABLE_EXCEPTIONS
218#define libmesh_noexcept noexcept
220#define LIBMESH_THROW(e) do { throw e; } while (0)
221#define libmesh_rethrow throw
222#define libmesh_try try
223#define libmesh_catch(e) catch(e)
227#define LIBMESH_THROW(e) do { libMesh::err << e.what(); libMesh::libmesh_abort(); } while (0)
228#define libmesh_rethrow
230#define libmesh_catch(e) if (0)
A class representing a solver's failure to converge, to be thrown by "libmesh_convergence_failure();"...
ConvergenceFailure(const std::string &err_msg="Unrecoverable failure to converge")
A class representing the detection of an unexpected degeneracy, e.g.
DegenerateMap(std::string msg="")
A class representing that a dynamic cast failed to produce expected output.
A class representing a failed attempt by the library to open a file (or construct an fstream,...
FileError(const std::string &filename, const std::string msg="")
A class representing a floating point exception.
A class to represent the internal "this should never happen" errors, to be thrown by "libmesh_error()...
LogicError(const std::string &msg)
A class to stub for features that should be in libMesh, but haven't been written yet,...
NotImplemented(std::string msg="")
A class representing an exception during a solve.
SolverException(int error_code_in)
int error_code
The error code generated by the solver.
virtual ~SolverException()=default
Virtual destructor, gotta have one of those.
std::string what_message
string which holds the message built in the constructor.
virtual const char * what() const noexcept override
Override the what() function to provide a generic error message.
A class representing an exception used only to send a program to the terminate handler for abort afte...
const char * what() const noexcept
The libMesh namespace provides an interface to certain functionality in the library.
void enableSIGINT(bool on)
Toggle libMesh handling of SIGINT (Ctrl+C) interrupts.
void enableFPE(bool on)
Toggle hardware trap floating point exceptions.
void libmesh_terminate_handler()
A terminate handler.
void enableSEGV(bool on)
Toggle libMesh reporting of segmentation faults.