summaryrefslogtreecommitdiff
path: root/source/libs/asura-lib-utils/exceptions/exception.h
blob: 57c9ed604a4e5b2f04420a58734d5cc03f865070 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#ifndef __ASURA_ENGINE_EXCEPTION_H__
#define __ASURA_ENGINE_EXCEPTION_H__

#include <string>
#include <exception>

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