Ocular Engine
Exception.hpp
1 
17 #pragma once
18 #ifndef __H__OCULAR_EXCEPTION__H__
19 #define __H__OCULAR_EXCEPTION__H__
20 
21 #include <stdexcept>
22 
23 #define THROW_EXCEPTION(msg) throw Ocular::Core::Exception(msg, __FILE__, __LINE__)
24 
25 //------------------------------------------------------------------------------------------
26 
31 namespace Ocular
32 {
37  namespace Core
38  {
42  class Exception : public std::runtime_error
43  {
44  public:
45 
46  Exception(std::string const& msg, std::string const file, int const line)
47  : runtime_error(msg), m_File(file), m_Line(line)
48  {
49  m_Message = what();
50  }
51 
52  inline std::string getMessage()
53  {
54  return m_Message;
55  }
56 
57  inline std::string getFile() const
58  {
59  return m_File;
60  }
61 
62  inline int getLine() const
63  {
64  return m_Line;
65  }
66 
67  protected:
68 
69  private:
70 
71  std::string m_File;
72  std::string m_Message;
73 
74  int m_Line;
75  };
76  }
80 }
85 //------------------------------------------------------------------------------------------
86 
87 #endif
Note: Once this library is made dynamic, this will no longer be needed.
Definition: Common.hpp:70
Definition: Exception.hpp:42