1 
2 #ifndef MUSTACHE_EXCEPTION_HPP
3 #define MUSTACHE_EXCEPTION_HPP
4 
5 #include <exception>
6 #include <stdexcept>
7 #include <string>
8 
9 namespace mustache {
10 
11 
12 /*! \class Exception
13     \brief Exception class
14 
15     Exceptions thrown will be of this class.
16 */
17 class Exception : public std::runtime_error {
18   public:
Exception(const std::string & desc)19       Exception(const std::string& desc) : std::runtime_error(desc) { }
20 };
21 
22 
23 /*! \class TokenizerException
24     \brief Exception class
25 
26     Exceptions thrown in the tokenizer will be of this class.
27 */
28 class TokenizerException : public Exception {
29   public:
30     const int lineNo;
31     const int charNo;
TokenizerException(const std::string & desc,int lineNo=0,int charNo=0)32     TokenizerException(const std::string& desc, int lineNo = 0, int charNo = 0) :
33         Exception(desc),
34         lineNo(lineNo),
35         charNo(charNo) {};
36 };
37 
38 
39 } // namespace Mustache
40 
41 #endif
42