CoriEngine
Loading...
Searching...
No Matches
Cori::Core::PossibleErrors< Exceptions > Class Template Reference

This class utilizes std::variant to hold one of the possible exception types. More...

#include <Error.hpp>

Public Member Functions

template<typename E>
requires (std::is_same_v<std::decay_t<E>, Exceptions> || ...)
 PossibleErrors (E &&e)
 ~PossibleErrors ()
 PossibleErrors (const PossibleErrors &other) noexcept
 PossibleErrors (PossibleErrors &&other) noexcept
PossibleErrorsoperator= (const PossibleErrors &other)=delete
PossibleErrorsoperator= (PossibleErrors &&other) noexcept=delete
const std::exception * GetRaw () const
 Returns a pointer to the exception held inside of the object.
template<typename Visitor>
void Visit (Visitor &&visitor) const &
 Visits the variant inside of the object with a callable.
template<typename Visitor>
void Visit (Visitor &&visitor) const &&
 Visits the variant inside of the object with a callable.
template<typename SpecificException, typename Func>
PossibleErrorsOn (Func &&handler) &
 Handles the exception with a callable if it is a specific exception type.
template<typename SpecificException, typename Func>
PossibleErrors && On (Func &&handler) &&
 Handles the exception with a callable if it is a specific exception type.
const char * GetWhat () const
 Simply returns the formated error message held inside the execution object.

Detailed Description

template<typename... Exceptions>
requires AllAreExceptions<Exceptions...>
class Cori::Core::PossibleErrors< Exceptions >

This class utilizes std::variant to hold one of the possible exception types.

Template Parameters
ExceptionsPossible exceptions. Should be either std::expected or derived from it.

Definition at line 156 of file Error.hpp.

Constructor & Destructor Documentation

◆ PossibleErrors() [1/3]

template<typename... Exceptions>
template<typename E>
requires (std::is_same_v<std::decay_t<E>, Exceptions> || ...)
Cori::Core::PossibleErrors< Exceptions >::PossibleErrors ( E && e)
inline

Definition at line 159 of file Error.hpp.

◆ ~PossibleErrors()

template<typename... Exceptions>
Cori::Core::PossibleErrors< Exceptions >::~PossibleErrors ( )
inline

Definition at line 161 of file Error.hpp.

◆ PossibleErrors() [2/3]

template<typename... Exceptions>
Cori::Core::PossibleErrors< Exceptions >::PossibleErrors ( const PossibleErrors< Exceptions > & other)
inlinenoexcept

Definition at line 169 of file Error.hpp.

Here is the call graph for this function:

◆ PossibleErrors() [3/3]

template<typename... Exceptions>
Cori::Core::PossibleErrors< Exceptions >::PossibleErrors ( PossibleErrors< Exceptions > && other)
inlinenoexcept

Definition at line 173 of file Error.hpp.

Here is the call graph for this function:

Member Function Documentation

◆ GetRaw()

template<typename... Exceptions>
const std::exception * Cori::Core::PossibleErrors< Exceptions >::GetRaw ( ) const
inlinenodiscard

Returns a pointer to the exception held inside of the object.

Returns
Pointer to the exception.

Definition at line 184 of file Error.hpp.

◆ GetWhat()

template<typename... Exceptions>
const char * Cori::Core::PossibleErrors< Exceptions >::GetWhat ( ) const
inline

Simply returns the formated error message held inside the execution object.

Returns
Formated error message.

Definition at line 249 of file Error.hpp.

Here is the call graph for this function:

◆ On() [1/2]

template<typename... Exceptions>
template<typename SpecificException, typename Func>
PossibleErrors & Cori::Core::PossibleErrors< Exceptions >::On ( Func && handler) &
inline

Handles the exception with a callable if it is a specific exception type.

Template Parameters
SpecificExceptionException type the method will handle.
Parameters
handlerA callable function that accepts SpecificException.
Note
This can be used as a monadic method.

Definition at line 219 of file Error.hpp.

Here is the call graph for this function:

◆ On() [2/2]

template<typename... Exceptions>
template<typename SpecificException, typename Func>
PossibleErrors && Cori::Core::PossibleErrors< Exceptions >::On ( Func && handler) &&
inline

Handles the exception with a callable if it is a specific exception type.

Template Parameters
SpecificExceptionException type the method will handle.
Parameters
handlerA callable function that accepts SpecificException.
Note
This can be used as a monadic method.

Definition at line 235 of file Error.hpp.

Here is the call graph for this function:

◆ operator=() [1/2]

template<typename... Exceptions>
PossibleErrors & Cori::Core::PossibleErrors< Exceptions >::operator= ( const PossibleErrors< Exceptions > & other)
delete
Here is the call graph for this function:

◆ operator=() [2/2]

template<typename... Exceptions>
PossibleErrors & Cori::Core::PossibleErrors< Exceptions >::operator= ( PossibleErrors< Exceptions > && other)
deletenoexcept
Here is the call graph for this function:

◆ Visit() [1/2]

template<typename... Exceptions>
template<typename Visitor>
void Cori::Core::PossibleErrors< Exceptions >::Visit ( Visitor && visitor) const &
inline

Visits the variant inside of the object with a callable.

Parameters
visitorA callable that is valid with any of the possible errors stored.

Definition at line 197 of file Error.hpp.

◆ Visit() [2/2]

template<typename... Exceptions>
template<typename Visitor>
void Cori::Core::PossibleErrors< Exceptions >::Visit ( Visitor && visitor) const &&
inline

Visits the variant inside of the object with a callable.

Parameters
visitorA callable that accepts and is valid with any of the possible errors stored.

Definition at line 207 of file Error.hpp.


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