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

Constructor & Destructor Documentation

libMesh::SolverException::SolverException ( int  error_code_in)

Definition at line 114 of file libmesh_exceptions.h.

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

Virtual destructor, gotta have one of those.

Definition at line 126 of file libmesh_exceptions.h.

126 {};

Member Function Documentation

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

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

Definition at line 131 of file libmesh_exceptions.h.

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

Member Data Documentation

int libMesh::SolverException::error_code

The error code generated by the solver.

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

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

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