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 105 of file libmesh_exceptions.h.

Constructor & Destructor Documentation

◆ SolverException()

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

Definition at line 108 of file libmesh_exceptions.h.

References error_code, and what_message.

108  :
109  std::exception(),
110  error_code(error_code_in)
111  {
112  std::ostringstream oss;
113  oss << "Error code " << error_code << " during solve." << std::endl;
114  what_message = oss.str();
115  }
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 125 of file libmesh_exceptions.h.

References what_message.

126  {
127  // std::string::c_str() is noexcept in C++11, so it's safe to call
128  // in what() because it can't throw.
129  return what_message.c_str();
130  }
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 135 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 140 of file libmesh_exceptions.h.

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


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