SpinParser  1.0
Public Types | Public Member Functions | Protected Attributes | List of all members
Exception Struct Reference

Descriptor object for exceptions. More...

#include <Exception.hpp>

Inheritance diagram for Exception:
Inheritance graph
[legend]
Collaboration diagram for Exception:
Collaboration graph
[legend]

Public Types

enum  Type {
  Type::GenericError, Type::InternalError, Type::BadAllocation, Type::OutOfRange,
  Type::ArgumentError, Type::InitializationError, Type::IOError, Type::AssertionFail,
  Type::MpiError
}
 Exception types. More...
 

Public Member Functions

 Exception (const Exception::Type type) noexcept
 Construct a new Exception object. More...
 
template<class T >
 Exception (const Exception::Type type, T details) noexcept
 Construct a new Exception object. More...
 
 ~Exception () noexcept
 Destroy the Exception object.
 
const char * what () const noexcept
 Retrieve string form description of the exception. More...
 
Exception::Type type () const noexcept
 Retrieve exception type. More...
 

Protected Attributes

Exception::Type _type
 Type of the exception.
 
std::string _what
 String form description of the exception.
 

Detailed Description

Descriptor object for exceptions.

Member Enumeration Documentation

◆ Type

enum Exception::Type
strong

Exception types.

Enumerator
GenericError 

Generic error.

InternalError 

Internal error, raised when internal inconsistencies occur.

BadAllocation 

Allocation error, raised when an allocation fails.

OutOfRange 

Out of range error, raised when out of bound memory accesses occur.

ArgumentError 

Argument error, raised when a function is invoked with an invalid argument.

InitializationError 

Initialization error, raised when initialization routines fail.

IOError 

In/out error, raised when input or output routines fail.

AssertionFail 

Assertion failure, raised when an assertion fails.

MpiError 

MPI error, raised when MPI communication fails.

Constructor & Destructor Documentation

◆ Exception() [1/2]

Exception::Exception ( const Exception::Type  type)
inlinenoexcept

Construct a new Exception object.

Parameters
typeType of exception to construct.

◆ Exception() [2/2]

template<class T >
Exception::Exception ( const Exception::Type  type,
details 
)
inlinenoexcept

Construct a new Exception object.

Template Parameters
TFundamental type of the exception detail descriptor. Must be convertible to a string.
Parameters
typeType of the exception.
detailsDetailed descriptor of the exception.

Member Function Documentation

◆ type()

Exception::Type Exception::type ( ) const
inlinenoexcept

Retrieve exception type.

Returns
Exception::Type Exception type.

◆ what()

const char* Exception::what ( ) const
inlinenoexcept

Retrieve string form description of the exception.

Returns
const char* String form description of the exception.

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