From 831e814ce9bdb84e86c06c4a52008f6bdaaa00d6 Mon Sep 17 00:00:00 2001 From: chai Date: Fri, 16 Nov 2018 00:24:51 +0800 Subject: =?UTF-8?q?*=E5=90=88=E5=B9=B6master=E5=88=B0minimal=E5=88=86?= =?UTF-8?q?=E6=94=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/libjin/Common/je_exception.h | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) (limited to 'src/libjin/Common/je_exception.h') diff --git a/src/libjin/Common/je_exception.h b/src/libjin/Common/je_exception.h index 7c66af8..c319ebd 100644 --- a/src/libjin/Common/je_exception.h +++ b/src/libjin/Common/je_exception.h @@ -1,19 +1,42 @@ -#ifndef __JE_EXCEPTION_H -#define __JE_EXCEPTION_H +#ifndef __JE_EXCEPTION_H__ +#define __JE_EXCEPTION_H__ #include +#include namespace JinEngine { /// - /// Built-in exception class. + /// Jin Exception. /// - class JinException : public std::exception + class Exception : public std::exception { public: - JinException(); - const char* what() const throw(); + + /// + /// 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; }; -- cgit v1.1-26-g67d0