OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
ak::aException Class Reference

The ak::Exception class can be used as an universal exception which may used to provide nicely readable exception messages. The provided exception message 'ex_what' is representing the exception message The provided where message 'ex_where' is representing the location where this exception is thrown from. If the exception will be catched by a try block, this exception can be thrown to the next higher level by providing just the new location. At the beginning of each provided location a '@ ' will be added A ak::Exception.what() message can look like this: Exception Message @ Inner function @ Outter function @ Initial calling function. More...

#include "aException.h"

Inheritance diagram for ak::aException:

Public Types

enum  exceptionType {
  Undefined = 0 , Arithmetic , ArrayOutOfBounds , FileNotFound ,
  IO , Nullptr , NumberFormat , InvalidInput ,
  UnknownCommand , BadAlloc
}
 Used to determine the type of the exception. More...
 

Public Member Functions

 aException ()
 Default constructor. Will initialize the type with undefined.
 
 aException (const char *_exWhat, const char *_exWhere, exceptionType _exType=exceptionType::Undefined)
 Assignment constructor. Will set the internal variables.
 
 aException (const std::string &_exWhat, const char *_exWhere, exceptionType _exType=exceptionType::Undefined)
 Assignment constructor. Will set the internal variables.
 
 aException (const std::string &_exWhat, const std::string &_exWhere, exceptionType _exType=exceptionType::Undefined)
 Assignment constructor. Will set the internal variables.
 
 aException (const char *_exWhat, const std::string &_exWhere, exceptionType _exType=exceptionType::Undefined)
 Assignment constructor. Will set the internal variables.
 
 aException (const aException &_other)
 Copy constructor. Will copy all information from the other exception.
 
 aException (const aException &_other, const char *_exWhere)
 Forward constructor. Will copy all information from the other exception and append the new location Will copy all the information contained in the other exception. Afterwards the new where location will be appended.
 
virtual ~aException () throw ()
 Deconstructor.
 
virtual const char * what () const override throw ()
 Will return the exception and location text.
 
std::string getWhat (void) const
 Returns a copy of the what message which represents the exception text.
 
std::string getWhere (void) const
 Return a copy of the what message which represents the location.
 
exceptionType getType (void) const
 Returns a copy of the exception type

 

Protected Member Functions

void buildOut (void)
 Contains the exception type which is initialized as undefined.
 

Protected Attributes

std::string m_what
 
std::string m_where
 Contains the exception message.
 
exceptionType m_type
 Contains the location desription.
 

Detailed Description

The ak::Exception class can be used as an universal exception which may used to provide nicely readable exception messages. The provided exception message 'ex_what' is representing the exception message The provided where message 'ex_where' is representing the location where this exception is thrown from. If the exception will be catched by a try block, this exception can be thrown to the next higher level by providing just the new location. At the beginning of each provided location a '@ ' will be added A ak::Exception.what() message can look like this: Exception Message @ Inner function @ Outter function @ Initial calling function.

Member Enumeration Documentation

◆ exceptionType

Used to determine the type of the exception.

Enumerator
Undefined 
Arithmetic 
ArrayOutOfBounds 
FileNotFound 
IO 
Nullptr 
NumberFormat 
InvalidInput 
UnknownCommand 
BadAlloc 

Constructor & Destructor Documentation

◆ aException() [1/7]

ak::aException::aException ( )

Default constructor. Will initialize the type with undefined.

◆ aException() [2/7]

ak::aException::aException ( const char * _exWhat,
const char * _exWhere,
exceptionType _exType = exceptionType::Undefined )

Assignment constructor. Will set the internal variables.

Parameters
_exWhatThe exception message
_exWhereThe location where the exception was thrown from (e.g. function name)
_exTypeThe type of the exception

◆ aException() [3/7]

ak::aException::aException ( const std::string & _exWhat,
const char * _exWhere,
exceptionType _exType = exceptionType::Undefined )

Assignment constructor. Will set the internal variables.

Parameters
_exWhatThe exception message
_exWhereThe location where the exception was thrown from (e.g. function name)
_exTypeThe type of the exception

◆ aException() [4/7]

ak::aException::aException ( const std::string & _exWhat,
const std::string & _exWhere,
exceptionType _exType = exceptionType::Undefined )

Assignment constructor. Will set the internal variables.

Parameters
_exWhatThe exception message
_exWhereThe location where the exception was thrown from (e.g. function name)
_exTypeThe type of the exception

◆ aException() [5/7]

ak::aException::aException ( const char * _exWhat,
const std::string & _exWhere,
exceptionType _exType = exceptionType::Undefined )

Assignment constructor. Will set the internal variables.

Parameters
_exWhatThe exception message
_exWhereThe location where the exception was thrown from (e.g. function name)
_exTypeThe type of the exception

◆ aException() [6/7]

ak::aException::aException ( const aException & _other)

Copy constructor. Will copy all information from the other exception.

Parameters
_otherThe other exception

◆ aException() [7/7]

ak::aException::aException ( const aException & _other,
const char * _exWhere )

Forward constructor. Will copy all information from the other exception and append the new location Will copy all the information contained in the other exception. Afterwards the new where location will be appended.

_other The other exception the information will be copied from

_exWhere The new location message which will be appended

◆ ~aException()

ak::aException::~aException ( )
throw ( )
virtual

Deconstructor.

Member Function Documentation

◆ buildOut()

void ak::aException::buildOut ( void )
protected

Contains the exception type which is initialized as undefined.

◆ getType()

ak::aException::exceptionType ak::aException::getType ( void ) const

Returns a copy of the exception type

◆ getWhat()

std::string ak::aException::getWhat ( void ) const

Returns a copy of the what message which represents the exception text.

◆ getWhere()

std::string ak::aException::getWhere ( void ) const

Return a copy of the what message which represents the location.

◆ what()

const char * ak::aException::what ( void ) const
throw ( )
overridevirtual

Will return the exception and location text.

Member Data Documentation

◆ m_type

exceptionType ak::aException::m_type
protected

Contains the location desription.

◆ m_what

std::string ak::aException::m_what
protected

◆ m_where

std::string ak::aException::m_where
protected

Contains the exception message.


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