libMesh
Public Member Functions | Public Attributes | List of all members
libMesh::SolverException Class Reference

A class representing an exception during a solve. More...

#include <libmesh_exceptions.h>

Inheritance diagram for libMesh::SolverException:
[legend]

Public Member Functions

 SolverException (int error_code_in)
 
virtual ~SolverException ()=default
 Virtual destructor, gotta have one of those. More...
 
virtual const char * what () const noexcept override
 Override the what() function to provide a generic error message. More...
 

Public Attributes

int error_code
 The error code generated by the solver. More...
 
std::string what_message
 string which holds the message built in the constructor. More...
 

Detailed Description

A class representing an exception during a solve.

Definition at line 159 of file libmesh_exceptions.h.

Constructor & Destructor Documentation

◆ SolverException()

libMesh::SolverException::SolverException ( int  error_code_in)
inline

Definition at line 162 of file libmesh_exceptions.h.

References error_code, and what_message.

162  :
163  std::exception(),
164  error_code(error_code_in)
165  {
166  std::ostringstream oss;
167  oss << "Error code " << error_code << " during solve." << std::endl;
168  what_message = oss.str();
169  }
int error_code
The error code generated by the solver.
std::string what_message
string which holds the message built in the constructor.

◆ ~SolverException()

virtual libMesh::SolverException::~SolverException ( )
virtualdefault

Virtual destructor, gotta have one of those.

Member Function Documentation

◆ what()

virtual const char* libMesh::SolverException::what ( ) const
inlineoverridevirtualnoexcept

Override the what() function to provide a generic error message.

Definition at line 179 of file libmesh_exceptions.h.

References what_message.

180  {
181  // std::string::c_str() is noexcept in C++11, so it's safe to call
182  // in what() because it can't throw.
183  return what_message.c_str();
184  }
std::string what_message
string which holds the message built in the constructor.

Member Data Documentation

◆ error_code

int libMesh::SolverException::error_code

The error code generated by the solver.

Definition at line 189 of file libmesh_exceptions.h.

Referenced by libMesh::PetscSolverException::PetscSolverException(), and SolverException().

◆ what_message

std::string libMesh::SolverException::what_message

string which holds the message built in the constructor.

Definition at line 194 of file libmesh_exceptions.h.

Referenced by libMesh::PetscSolverException::PetscSolverException(), SolverException(), and what().


The documentation for this class was generated from the following file: