summaryrefslogtreecommitdiffabout
path: root/include/sitecing/sitecing_exception.h
blob: bf475ac6345e4ea14564e16af38d4fbc5700de5c (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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#ifndef __SITECING_SITECING_EXCEPTION_H
#define __SITECING_SITECING_EXCEPTION_H

#include <konforka/exception.h>

/**
 * @file
 * @brief The site-C-ing specific exception.
 */

namespace sitecing {

    /**
     * The component failed to compile.
     */
    class compile_error : public konforka::exception {
	public:
	    /**
	     * The component path
	     */
	    string component_path;

	    /**
	     * @param w the message.
	     * @param cp component path.
	     */
	    compile_error(const string& w,const string& cp)
		: konforka::exception(NOCODEPOINT,w), component_path(cp) { }
	    /**
	     * @param whe point in code.
	     * @param wha the message.
	     * @param cp component path.
	     */
	    compile_error(const string &whe,const string& wha,const string& cp)
		: konforka::exception(whe,wha), component_path(cp) { }
	    /**
	     * @param fi the file name where the exception is thrown from.
	     * @param fu the function name where the exception originates from.
	     * @param l the line number where the exception originates from.
	     * @param cp component path.
	     */
	    compile_error(const string &fi,const string& fu,int l,const string& w,const string& cp)
		: konforka::exception(fi,fu,l,w), component_path(cp) { }
	    ~compile_error() throw() { }
    };

    /**
     * Failed to preprocess component source.
     */
    class preprocessor_error : public konforka::exception {
	public:
	    /**
	     * Component name.
	     */
	    string component_name;
	    /**
	     * The line number of the source code where the error occured.
	     */
	    int line_number;

	    /**
	     * @param fi file name where the exception originates from.
	     * @param fu the function name where the exception originates from.
	     * @param l the line number where the exception originate from.
	     * @param w the error message.
	     * @param cn the component name.
	     * @param ln the line of the component source where the error occured.
	     */
	    preprocessor_error(const string& fi,const string& fu,int l,const string& w,const string& cn,int ln)
		: konforka::exception(fi,fu,l,w), component_name(cn), line_number(ln) { }
	    /**
	     * @param fi file name where the exception originates from.
	     * @param fu the function name where the exception originates from.
	     * @param l the line number where the exception originate from.
	     * @param w the error message.
	     * @param cn the component name.
	     */
	    preprocessor_error(const string& fi,const string& fu,int l,const string& w,const string& cn)
		: konforka::exception(fi,fu,l,w), component_name(cn), line_number(-1) { }
	    /**
	     * @param fi file name where the exception originates from.
	     * @param fu the function name where the exception originates from.
	     * @param l the line number where the exception originate from.
	     * @param w the error message.
	     * @param ln the line of the component source where the error occured.
	     */
	    preprocessor_error(const string& fi,const string& fu,int l,const string& w,int ln)
		: konforka::exception(fi,fu,l,w), line_number(ln) { }
	    /**
	     * @param fi file name where the exception originates from.
	     * @param fu the function name where the exception originates from.
	     * @param l the line number where the exception originate from.
	     * @param w the error message.
	     */
	    preprocessor_error(const string& fi,const string& fu,int l,const string& w)
		: konforka::exception(fi,fu,l,w), line_number(-1) { }

	    ~preprocessor_error() throw() {}
    };

}

#endif /* __SITECING_SITECING_EXCEPTION_H */