Leviathan  0.8.0.0
Leviathan game engine
Leviathan::Exception Class Reference

Base class for all exceptions thrown by Leviathan. More...

#include <Exceptions.h>

+ Inheritance diagram for Leviathan::Exception:

Public Member Functions

DLLEXPORT Exception (const char *description) noexcept
 
DLLEXPORT Exception (const std::string &description) noexcept
 
DLLEXPORT Exception (const Exception &e) noexcept
 
 ~Exception ()=default
 
DLLEXPORT Exceptionoperator= (const Exception &other) noexcept
 
DLLEXPORT const char * what () const noexcept override
 
virtual DLLEXPORT void PrintToLog () const noexcept
 
virtual DLLEXPORT void Print (LErrorReporter *errorreport) const noexcept
 

Protected Attributes

std::string Message
 

Detailed Description

Base class for all exceptions thrown by Leviathan.

Definition at line 10 of file Exceptions.h.

Constructor & Destructor Documentation

◆ Exception() [1/3]

DLLEXPORT Leviathan::Exception::Exception ( const char *  description)
noexcept
Parameters
descriptionDescription of the error in utf8 encoding

Definition at line 9 of file Exceptions.cpp.

9  : Message(description){
10 
11 }
std::string Message
Definition: Exceptions.h:31

◆ Exception() [2/3]

DLLEXPORT Leviathan::Exception::Exception ( const std::string &  description)
noexcept

Definition at line 13 of file Exceptions.cpp.

13  :
14  Message(description)
15 {
16 
17 }
std::string Message
Definition: Exceptions.h:31

◆ Exception() [3/3]

DLLEXPORT Leviathan::Exception::Exception ( const Exception e)
noexcept

Definition at line 19 of file Exceptions.cpp.

19  : Message(e.Message){
20 
21 }
std::string Message
Definition: Exceptions.h:31

◆ ~Exception()

Leviathan::Exception::~Exception ( )
default

Member Function Documentation

◆ operator=()

DLLEXPORT Exception & Leviathan::Exception::operator= ( const Exception other)
noexcept

Definition at line 23 of file Exceptions.cpp.

23  {
24 
25  Message = other.Message;
26  return *this;
27 }
std::string Message
Definition: Exceptions.h:31

◆ Print()

DLLEXPORT void Leviathan::Exception::Print ( LErrorReporter errorreport) const
virtualnoexcept

Definition at line 41 of file Exceptions.cpp.

41  {
42 
43  LEVIATHAN_ASSERT(errorreport != nullptr, "erroreport in Exception::Print may not be null");
44  errorreport->Write(string("[EXCEPTION] ") + Message);
45 }
std::string Message
Definition: Exceptions.h:31
#define LEVIATHAN_ASSERT(x, msg)
Definition: Define.h:98
virtual void Write(const std::string &Text)=0

◆ PrintToLog()

DLLEXPORT void Leviathan::Exception::PrintToLog ( ) const
virtualnoexcept

Definition at line 35 of file Exceptions.cpp.

35  {
36 
37  Logger::Get()->Write(string("[EXCEPTION] ")+Message);
38 }
DLLEXPORT void Write(const std::string &data) override
Definition: Logger.cpp:113
std::string Message
Definition: Exceptions.h:31
static DLLEXPORT Logger * Get()
Definition: Logger.cpp:106

◆ what()

DLLEXPORT const char * Leviathan::Exception::what ( ) const
overridenoexcept

Definition at line 29 of file Exceptions.cpp.

29  {
30 
31  return Message.c_str();
32 }
std::string Message
Definition: Exceptions.h:31

Member Data Documentation

◆ Message

std::string Leviathan::Exception::Message
protected

Definition at line 31 of file Exceptions.h.


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