]> git.tdb.fi Git - libs/datafile.git/blob - source/except.h
ed9ca2337f98c667a4fa40014f9f8477cdf86314
[libs/datafile.git] / source / except.h
1 #ifndef MSP_DATAFILE_EXCEPT_H_
2 #define MSP_DATAFILE_EXCEPT_H_
3
4 #include <stdexcept>
5 #include <typeinfo>
6
7 namespace Msp {
8 namespace DataFile {
9
10 class data_error: public std::runtime_error
11 {
12 private:
13         std::string source;
14         unsigned line;
15
16 public:
17         data_error(const std::string &, unsigned, const std::string &);
18         data_error(const std::string &, unsigned, const std::exception &);
19         virtual ~data_error() throw() { }
20
21         const std::string &get_source() const { return source; }
22         unsigned get_line() const { return line; }
23
24 private:
25         std::string make_what(const std::string &, unsigned, const std::string &);
26 };
27
28
29 class parse_error: public std::runtime_error
30 {
31 public:
32         parse_error(const std::string &);
33         virtual ~parse_error() throw() { }
34 };
35
36
37 class syntax_error: public std::runtime_error
38 {
39 public:
40         syntax_error(const std::string &t);
41         virtual ~syntax_error() throw() { }
42 };
43
44
45 class bad_definition: public std::runtime_error
46 {
47 public:
48         bad_definition(const std::string &w);
49         virtual ~bad_definition() throw() { }
50 };
51
52
53 class nesting_error: public std::logic_error
54 {
55 public:
56         nesting_error(const std::string &);
57         virtual ~nesting_error() throw() { }
58 };
59
60
61 class unknown_keyword: public std::runtime_error
62 {
63 public:
64         unknown_keyword(const std::string &);
65         virtual ~unknown_keyword() throw() { }
66 };
67
68
69 class invalid_signature: public std::runtime_error
70 {
71 public:
72         invalid_signature(const std::string &, const std::string &);
73         virtual ~invalid_signature() throw() { }
74 };
75
76
77 class no_collection: public std::runtime_error
78 {
79 public:
80         no_collection(const std::type_info &);
81 };
82
83 } // namespace DataFile
84 } // namespace Msp
85
86 #endif