Support Class Library
A set of tools providing classes and utility
Public Member Functions | Protected Attributes | List of all members
scl::exceptions::Exception Class Reference

Base class for all regular exceptions. More...

#include "Exception.h"

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

Public Member Functions

template<class T >
 Exception (T &&reason)
 Construct an scl::exceptions::Exception from an error message. More...
 
const char *const reason () const override
 Retrieve the reason. More...
 
const char * what () const noexcept override
 Override that uses the user defined reason. More...
 
const char *const type () const noexcept override
 A string describing the name of the exception class. More...
 

Protected Attributes

const char *const _reason = ""
 The error message that comes with this Exception. More...
 

Detailed Description

Base class for all regular exceptions.

Definition at line 12 of file Exception.h.

Constructor & Destructor Documentation

◆ Exception()

template<class T >
scl::exceptions::Exception::Exception ( T &&  reason)
inline

Construct an scl::exceptions::Exception from an error message.

Template Parameters
Tbeing the reason's type
Parameters
reasonbeing the error message

Definition at line 27 of file Exception.h.

Member Function Documentation

◆ reason()

const char* const scl::exceptions::Exception::reason ( ) const
inlineoverridevirtual

Retrieve the reason.

Returns
the reason as a const char* const

Reimplemented from scl::exceptions::Throwable.

Definition at line 34 of file Exception.h.

◆ type()

const char* const scl::exceptions::Exception::type ( ) const
inlineoverridevirtualnoexcept

A string describing the name of the exception class.

Returns
the fully qualified name of this class

Implements scl::exceptions::Throwable.

Reimplemented in scl::exceptions::InvalidAnyCast, scl::exceptions::InvalidArgument, scl::exceptions::InvalidCast, scl::exceptions::OutOfBound, scl::exceptions::InvalidEitherAccess, scl::exceptions::InvalidResultAccess, and scl::exceptions::NonNullViolation.

Definition at line 50 of file Exception.h.

◆ what()

const char* scl::exceptions::Exception::what ( ) const
inlineoverridenoexcept

Override that uses the user defined reason.

Returns
the reason

Definition at line 42 of file Exception.h.

Member Data Documentation

◆ _reason

scl::exceptions::Exception::_reason = ""
protected

The error message that comes with this Exception.

Definition at line 18 of file Exception.h.


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