From 64d9d7b3eb7cece81da8b2cb56eb0f50d87a5964 Mon Sep 17 00:00:00 2001 From: chai Date: Fri, 1 Mar 2019 08:50:34 +0800 Subject: *misc --- Source/Asura.Engine/Exceptions/Exception.h | 43 ++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) (limited to 'Source/Asura.Engine/Exceptions/Exception.h') diff --git a/Source/Asura.Engine/Exceptions/Exception.h b/Source/Asura.Engine/Exceptions/Exception.h index e69de29..bed8a9a 100644 --- a/Source/Asura.Engine/Exceptions/Exception.h +++ b/Source/Asura.Engine/Exceptions/Exception.h @@ -0,0 +1,43 @@ +#ifndef __ASURA_ENGINE_EXCEPTION_H__ +#define __ASURA_ENGINE_EXCEPTION_H__ + +#include + +namespace AsuraEngine +{ + + /** + * A convenient vararg-enabled exception class. + **/ + class Exception : public std::exception + { + public: + + /** + * Creates a new Exception according to printf-rules. + * + * See: http://www.cplusplus.com/reference/clibrary/cstdio/printf/ + * + * @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 message.c_str(); + } + + private: + + std::string message; + + }; // Exception + +} + +#endif \ No newline at end of file -- cgit v1.1-26-g67d0