MoReFEM
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes
MoReFEM::SolidNS::UndefinedData Class Reference

Exception thrown when access to an undefined data is attempted. More...

#include <Solid.hpp>

Inheritance diagram for MoReFEM::SolidNS::UndefinedData:
Collaboration diagram for MoReFEM::SolidNS::UndefinedData:

Public Member Functions

 UndefinedData (const std::string &data, const std::source_location location=std::source_location::current())
 Constructor with simple message.
 
virtual ~UndefinedData () override
 Destructor.
 
 UndefinedData (const UndefinedData &rhs)=default
 The copy constructor.
 
 UndefinedData (UndefinedData &&rhs)=default
 The move constructor.
 
UndefinedDataoperator= (const UndefinedData &rhs)=default
 The (copy) operator=.
 
UndefinedDataoperator= (UndefinedData &&rhs)=default
 The (move) operator=.
 
virtual const char * what () const noexcept override final
 Display the what message from std::exception.
 
const std::string & GetRawMessage () const noexcept
 Display the raw message (Without file and line).
 

Private Attributes

std::string what_message_
 The complete what() message (with the location part)
 
std::string raw_message_
 Incomplete message (might be useful if we catch an exception to tailor a more specific message).
 

Detailed Description

Exception thrown when access to an undefined data is attempted.

Constructor & Destructor Documentation

◆ UndefinedData() [1/3]

MoReFEM::SolidNS::UndefinedData::UndefinedData ( const std::string & data,
const std::source_location location = std::source_location::current() )
explicit

Constructor with simple message.

Parameters
[in]dataName of the data concerned, e.g. 'volumic mass'.
Parameters
[in]locationSTL object with relevant information about the calling site (usually to help when an exception is thrown.

◆ UndefinedData() [2/3]

MoReFEM::SolidNS::UndefinedData::UndefinedData ( const UndefinedData & rhs)
default

The copy constructor.

Parameters
[in]rhsThe object from which the construction occurs.

◆ UndefinedData() [3/3]

MoReFEM::SolidNS::UndefinedData::UndefinedData ( UndefinedData && rhs)
default

The move constructor.

Parameters
[in]rhsThe object from which the construction occurs.

Member Function Documentation

◆ operator=() [1/2]

UndefinedData & MoReFEM::SolidNS::UndefinedData::operator= ( const UndefinedData & rhs)
default

The (copy) operator=.

Parameters
[in]rhsThe object from which the affectation occurs.
Returns
Reference to the object (to enable chained affectation).

◆ operator=() [2/2]

UndefinedData & MoReFEM::SolidNS::UndefinedData::operator= ( UndefinedData && rhs)
default

The (move) operator=.

Parameters
[in]rhsThe object from which the affectation occurs.
Returns
Reference to the object (to enable chained affectation).

◆ what()

virtual const char * MoReFEM::Exception::what ( ) const
finaloverridevirtualnoexceptinherited

Display the what message from std::exception.

Returns
The what() message as a char* (which reads the internal std::string so no risk of deallocation issue).

◆ GetRawMessage()

const std::string & MoReFEM::Exception::GetRawMessage ( ) const
noexceptinherited

Display the raw message (Without file and line).

Might be useful if exception is caught to rewrite a more refined message.

Before introducing this, we could end up in some cases with something like:

* Exception caught: Exception found at Sources/Model/Internal/InitializeHelper.hxx, line 114: Ill-defined
* finite element space 1: Exception found at Sources/Model/Internal/InitializeHelper.hxx, line 101:
* Domain 1 is not defined!
* 

Clearly it is nicer to provide:

* Exception caught: Exception found at Sources/Model/Internal/InitializeHelper.hxx, line 114: Ill-defined
* finite element space 1: Domain 1 is not defined!
* 
Returns
Exception error message without information about file and line in which the exception was invoked.

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