libMesh::SolverException Class Reference

#include <libmesh_exceptions.h>

Inheritance diagram for libMesh::SolverException:

Public Member Functions

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

Public Attributes

int error_code
std::string what_message

Detailed Description

A class representing an exception during a solve.

Definition at line 110 of file libmesh_exceptions.h.

Constructor & Destructor Documentation

libMesh::SolverException::SolverException ( int  error_code_in)

Definition at line 113 of file libmesh_exceptions.h.

113  :
114  std::exception(),
115  error_code(error_code_in)
116  {
117  std::ostringstream oss;
118  oss << "Error code " << error_code << " during solve." << std::endl;
119  what_message = oss.str();
120  }
virtual libMesh::SolverException::~SolverException ( )

Virtual destructor, gotta have one of those.

Definition at line 125 of file libmesh_exceptions.h.

125 {};

Member Function Documentation

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

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

Definition at line 130 of file libmesh_exceptions.h.

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

Member Data Documentation

int libMesh::SolverException::error_code

The error code generated by the solver.

Definition at line 140 of file libmesh_exceptions.h.

Referenced by libMesh::PetscSolverException::PetscSolverException().

std::string libMesh::SolverException::what_message

string which holds the message built in the constructor.

Definition at line 145 of file libmesh_exceptions.h.

Referenced by libMesh::PetscSolverException::PetscSolverException().

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