blob: 7a6879dfccd8c7e1d0692b1a8573e7823a089d99 (
plain) (
blame)
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
|
#ifndef EXC_H
#define EXC_H
#include "consts.h"
#include <string>
using std::string;
/** @class GeneralError
* The top-level exception
*/
class GeneralError {
public:
virtual string get_msg() = 0; /**< Extract error message */
};
class SyntaxError : public GeneralError {
protected:
string msg; /**< Error mesg */
ErrCode code; /**< Error code */
public:
SyntaxError(ErrCode code); /**< Construct an SyntaxError */
string get_msg(); /**< Get the error message */
};
class TokenError : public SyntaxError {
public:
TokenError(string token, ErrCode code); /**< Construct an TokenError */
};
class NormalError : public SyntaxError {
public:
NormalError(ErrCode code);
};
#endif
|