R-Type
R-Type project
Errors.hpp
1 /*
2 ** EPITECH PROJECT, 2022
3 ** gameEngine2
4 ** File description:
5 ** Errors
6 */
7 
8 #ifndef ERRORS_HPP_
9 #define ERRORS_HPP_
10 
11 #include <exception>
12 #include <string>
13 #include "Profiler/KapProfiler.hpp"
14 
15 namespace KapEngine {
16 
22  namespace Errors {
23 
24  class Error : public virtual std::exception {
25  protected:
26  std::string _message;
27  public:
28  explicit Error(std::string const& msg) {
29  PROFILER_FUNC_START();
30  _message = msg;
31  PROFILER_FUNC_END();
32  }
33 
34  ~Error() = default;
35 
36  const char* what() const noexcept override {
37  PROFILER_FUNC_START();
38  PROFILER_FUNC_END();
39  return _message.c_str();
40  }
41  };
42 
43  class ComponentError : public Error {
44  public:
45  ComponentError(std::string const& msg) : Error(msg) {
46  PROFILER_FUNC_START();
47  PROFILER_FUNC_END();
48  }
49  ~ComponentError() = default;
50  };
51 
52  class GameObjectError : public Error {
53  public:
54  GameObjectError(std::string const& msg) : Error(msg) {
55  PROFILER_FUNC_START();
56  PROFILER_FUNC_END();
57  }
58  ~GameObjectError() = default;
59  };
60 
61  class EngineError : public Error {
62  public:
63  EngineError(std::string const& msg) : Error(msg) {
64  PROFILER_FUNC_START();
65  PROFILER_FUNC_END();
66  }
67  ~EngineError() = default;
68  };
69 
70  class SceneError : public Error {
71  public:
72  SceneError(std::string const& msg) : Error(msg) {
73  PROFILER_FUNC_START();
74  PROFILER_FUNC_END();
75  }
76  ~SceneError() = default;
77  };
78 
79  class GameError : public Error {
80  public:
81  GameError(std::string const& msg) : Error(msg) {
82  PROFILER_FUNC_START();
83  PROFILER_FUNC_END();
84  }
85  ~GameError() = default;
86  };
87 
88  class GraphicalSystemError : public Error {
89  public:
90  GraphicalSystemError(std::string const& msg) : Error(msg) {
91  PROFILER_FUNC_START();
92  PROFILER_FUNC_END();
93  }
94  ~GraphicalSystemError() = default;
95  };
96 
97  }
98 
99 }
100 
101 #endif /* !ERRORS_HPP_ */
KapEngine::Errors::ComponentError
Definition: Errors.hpp:43
KapEngine::Errors::EngineError
Definition: Errors.hpp:61
KapEngine::Errors::GameObjectError
Definition: Errors.hpp:52
KapEngine::Errors::GameError
Definition: Errors.hpp:79
KapEngine::Errors::Error
Definition: Errors.hpp:24
KapEngine
main namespace
Definition: Component.hpp:17
KapEngine::Errors::SceneError
Definition: Errors.hpp:70
KapEngine::Errors::GraphicalSystemError
Definition: Errors.hpp:88