aboutsummaryrefslogtreecommitdiff
path: root/src/libjin/common/je_exception.h
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2018-11-18 23:31:17 +0800
committerchai <chaifix@163.com>2018-11-18 23:31:17 +0800
commitf0f340dec7821cee103ab9267ef941a917ef4dc4 (patch)
tree2f77f6ce6bdc9f63f002c13d4c261e1d6a9c1729 /src/libjin/common/je_exception.h
parentfc7b4579e49aaeecc81919e247e03f68bd5abfd4 (diff)
*目录改为小写
Diffstat (limited to 'src/libjin/common/je_exception.h')
-rw-r--r--src/libjin/common/je_exception.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/libjin/common/je_exception.h b/src/libjin/common/je_exception.h
new file mode 100644
index 0000000..c319ebd
--- /dev/null
+++ b/src/libjin/common/je_exception.h
@@ -0,0 +1,45 @@
+#ifndef __JE_EXCEPTION_H__
+#define __JE_EXCEPTION_H__
+
+#include <exception>
+#include <string>
+
+namespace JinEngine
+{
+
+ ///
+ /// Jin Exception.
+ ///
+ class Exception : public std::exception
+ {
+ public:
+
+ ///
+ /// Creates a new Exception according to printf-rules.
+ ///
+ /// @param fmt The format string (see printf).
+ ///
+ Exception(const char *fmt, ...);
+ virtual ~Exception() throw();
+
+ ///
+ /// Returns a string containing reason for the exception.
+ ///
+ /// @return A description of the exception.
+ ///
+ inline virtual const char *what() const throw()
+ {
+ return mMessage.c_str();
+ }
+
+ private:
+ ///
+ /// Exception message.
+ ///
+ std::string mMessage;
+
+ };
+
+} // namespace JinEngine
+
+#endif \ No newline at end of file