libMesh::SolverException Class Reference

#include <libmesh_exceptions.h>

Inheritance diagram for libMesh::SolverException:

Public Member Functions

 SolverException (int error_code_in)
 
virtual ~SolverException () noexcept
 
virtual const char * what () const noexcept
 

Public Attributes

int error_code
 
std::string what_message
 

Detailed Description

A class representing an exception during a solve.

Definition at line 107 of file libmesh_exceptions.h.

Constructor & Destructor Documentation

◆ SolverException()

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

Definition at line 110 of file libmesh_exceptions.h.

References error_code, and what_message.

110  :
111  std::exception(),
112  error_code(error_code_in)
113  {
114  std::ostringstream oss;
115  oss << "Error code " << error_code << " during solve." << std::endl;
116  what_message = oss.str();
117  }

◆ ~SolverException()

virtual libMesh::SolverException::~SolverException ( )
inlinevirtualnoexcept

Virtual destructor, gotta have one of those.

Definition at line 122 of file libmesh_exceptions.h.

122 {};

Member Function Documentation

◆ what()

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

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

Definition at line 127 of file libmesh_exceptions.h.

References what_message.

128  {
129  // std::string::c_str() is noexcept in C++11, so it's safe to call
130  // in what() because it can't throw.
131  return what_message.c_str();
132  }

Member Data Documentation

◆ error_code

int libMesh::SolverException::error_code

The error code generated by the solver.

Definition at line 137 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 142 of file libmesh_exceptions.h.

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


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