Leviathan  0.8.0.0
Leviathan game engine
Exceptions.h
Go to the documentation of this file.
1 #pragma once
2 // ------------------------------------ //
3 #include "Include.h"
4 #include <exception>
5 #include "ErrorReporter.h"
6 
7 namespace Leviathan{
8 
10 class Exception : public std::exception{
11 public:
13  DLLEXPORT Exception(const char* description) noexcept;
14  DLLEXPORT Exception(const std::string &description) noexcept;
15  DLLEXPORT Exception(const Exception &e) noexcept;
16 
17  ~Exception() = default;
18 
19  DLLEXPORT Exception& operator=(const Exception &other) noexcept;
20 
21  DLLEXPORT const char* what() const noexcept override;
22 
23 #ifndef LEVIATHAN_UE_PLUGIN
24  DLLEXPORT virtual void PrintToLog() const noexcept;
25 #endif
26 
27  DLLEXPORT virtual void Print(LErrorReporter* errorreport) const noexcept;
28 
29 protected:
30 
31  std::string Message;
32 };
33 
34 
35 class InvalidAccess : public Exception{
36 public:
37  DLLEXPORT InvalidAccess(const char* description) noexcept;
38  DLLEXPORT InvalidAccess(const std::string &description) noexcept;
39 };
40 
41 class InvalidArgument : public Exception{
42 public:
43  DLLEXPORT InvalidArgument(const char* description) noexcept;
44  DLLEXPORT InvalidArgument(const std::string &description) noexcept;
45 };
46 
47 class InvalidState : public Exception{
48 public:
49  DLLEXPORT InvalidState(const char* description) noexcept;
50  DLLEXPORT InvalidState(const std::string &description) noexcept;
51 };
52 
53 class InvalidType : public Exception{
54 public:
55  DLLEXPORT InvalidType(const char* description) noexcept;
56  DLLEXPORT InvalidType(const std::string &description) noexcept;
57 };
58 
59 class NotFound : public Exception{
60 public:
61  DLLEXPORT NotFound(const char* description) noexcept;
62  DLLEXPORT NotFound(const std::string &description) noexcept;
63 };
64 
65 class NULLPtr : public Exception{
66 public:
67  DLLEXPORT NULLPtr(const char* description) noexcept;
68  DLLEXPORT NULLPtr(const std::string &description) noexcept;
69 };
70 }
71 
72 #ifdef LEAK_INTO_GLOBAL
78 #endif
DLLEXPORT NULLPtr(const char *description) noexcept
Definition: Exceptions.cpp:78
DLLEXPORT Exception & operator=(const Exception &other) noexcept
Definition: Exceptions.cpp:23
std::string Message
Definition: Exceptions.h:31
Base class for all exceptions thrown by Leviathan.
Definition: Exceptions.h:10
DLLEXPORT const char * what() const noexcept override
Definition: Exceptions.cpp:29
DLLEXPORT InvalidAccess(const char *description) noexcept
Definition: Exceptions.cpp:48
virtual DLLEXPORT void Print(LErrorReporter *errorreport) const noexcept
Definition: Exceptions.cpp:41
DLLEXPORT InvalidState(const char *description) noexcept
Definition: Exceptions.cpp:60
DLLEXPORT InvalidType(const char *description) noexcept
Definition: Exceptions.cpp:66
#define DLLEXPORT
Definition: Include.h:84
DLLEXPORT Exception(const char *description) noexcept
Definition: Exceptions.cpp:9
The access mask controls which registered functions and classes a script sees.
Definition: GameModule.h:12
DLLEXPORT InvalidArgument(const char *description) noexcept
Definition: Exceptions.cpp:54
DLLEXPORT NotFound(const char *description) noexcept
Definition: Exceptions.cpp:72
virtual DLLEXPORT void PrintToLog() const noexcept
Definition: Exceptions.cpp:35