summaryrefslogtreecommitdiffabout
path: root/include/sitecing/sitecing_exception.h
Side-by-side diff
Diffstat (limited to 'include/sitecing/sitecing_exception.h') (more/less context) (ignore whitespace changes)
-rw-r--r--include/sitecing/sitecing_exception.h103
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 @@
+#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 */