Diffstat (limited to 'include/sitecing/sitecing_exception.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | include/sitecing/sitecing_exception.h | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/include/sitecing/sitecing_exception.h b/include/sitecing/sitecing_exception.h new file mode 100644 index 0000000..bf475ac --- a/dev/null +++ b/include/sitecing/sitecing_exception.h | |||
@@ -0,0 +1,103 @@ | |||
1 | #ifndef __SITECING_SITECING_EXCEPTION_H | ||
2 | #define __SITECING_SITECING_EXCEPTION_H | ||
3 | |||
4 | #include <konforka/exception.h> | ||
5 | |||
6 | /** | ||
7 | * @file | ||
8 | * @brief The site-C-ing specific exception. | ||
9 | */ | ||
10 | |||
11 | namespace sitecing { | ||
12 | |||
13 | /** | ||
14 | * The component failed to compile. | ||
15 | */ | ||
16 | class compile_error : public konforka::exception { | ||
17 | public: | ||
18 | /** | ||
19 | * The component path | ||
20 | */ | ||
21 | string component_path; | ||
22 | |||
23 | /** | ||
24 | * @param w the message. | ||
25 | * @param cp component path. | ||
26 | */ | ||
27 | compile_error(const string& w,const string& cp) | ||
28 | : konforka::exception(NOCODEPOINT,w), component_path(cp) { } | ||
29 | /** | ||
30 | * @param whe point in code. | ||
31 | * @param wha the message. | ||
32 | * @param cp component path. | ||
33 | */ | ||
34 | compile_error(const string &whe,const string& wha,const string& cp) | ||
35 | : konforka::exception(whe,wha), component_path(cp) { } | ||
36 | /** | ||
37 | * @param fi the file name where the exception is thrown from. | ||
38 | * @param fu the function name where the exception originates from. | ||
39 | * @param l the line number where the exception originates from. | ||
40 | * @param cp component path. | ||
41 | */ | ||
42 | compile_error(const string &fi,const string& fu,int l,const string& w,const string& cp) | ||
43 | : konforka::exception(fi,fu,l,w), component_path(cp) { } | ||
44 | ~compile_error() throw() { } | ||
45 | }; | ||
46 | |||
47 | /** | ||
48 | * Failed to preprocess component source. | ||
49 | */ | ||
50 | class preprocessor_error : public konforka::exception { | ||
51 | public: | ||
52 | /** | ||
53 | * Component name. | ||
54 | */ | ||
55 | string component_name; | ||
56 | /** | ||
57 | * The line number of the source code where the error occured. | ||
58 | */ | ||
59 | int line_number; | ||
60 | |||
61 | /** | ||
62 | * @param fi file name where the exception originates from. | ||
63 | * @param fu the function name where the exception originates from. | ||
64 | * @param l the line number where the exception originate from. | ||
65 | * @param w the error message. | ||
66 | * @param cn the component name. | ||
67 | * @param ln the line of the component source where the error occured. | ||
68 | */ | ||
69 | preprocessor_error(const string& fi,const string& fu,int l,const string& w,const string& cn,int ln) | ||
70 | : konforka::exception(fi,fu,l,w), component_name(cn), line_number(ln) { } | ||
71 | /** | ||
72 | * @param fi file name where the exception originates from. | ||
73 | * @param fu the function name where the exception originates from. | ||
74 | * @param l the line number where the exception originate from. | ||
75 | * @param w the error message. | ||
76 | * @param cn the component name. | ||
77 | */ | ||
78 | preprocessor_error(const string& fi,const string& fu,int l,const string& w,const string& cn) | ||
79 | : konforka::exception(fi,fu,l,w), component_name(cn), line_number(-1) { } | ||
80 | /** | ||
81 | * @param fi file name where the exception originates from. | ||
82 | * @param fu the function name where the exception originates from. | ||
83 | * @param l the line number where the exception originate from. | ||
84 | * @param w the error message. | ||
85 | * @param ln the line of the component source where the error occured. | ||
86 | */ | ||
87 | preprocessor_error(const string& fi,const string& fu,int l,const string& w,int ln) | ||
88 | : konforka::exception(fi,fu,l,w), line_number(ln) { } | ||
89 | /** | ||
90 | * @param fi file name where the exception originates from. | ||
91 | * @param fu the function name where the exception originates from. | ||
92 | * @param l the line number where the exception originate from. | ||
93 | * @param w the error message. | ||
94 | */ | ||
95 | preprocessor_error(const string& fi,const string& fu,int l,const string& w) | ||
96 | : konforka::exception(fi,fu,l,w), line_number(-1) { } | ||
97 | |||
98 | ~preprocessor_error() throw() {} | ||
99 | }; | ||
100 | |||
101 | } | ||
102 | |||
103 | #endif /* __SITECING_SITECING_EXCEPTION_H */ | ||