aboutsummaryrefslogtreecommitdiff
path: root/src/libjin/common/exception.h
blob: f46b60752520109be80006028700372833bf0b53 (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
45
46
#ifndef __JE_EXCEPTION_H__
#define __JE_EXCEPTION_H__

#include <exception>
#include <string>

#include "object.h"

namespace JinEngine
{

	///
	/// Jin Exception.
	///
	class Exception : public Object, 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