aboutsummaryrefslogtreecommitdiffstats
path: root/src/libgamma-error.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/libgamma-error.hh')
-rw-r--r--src/libgamma-error.hh43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/libgamma-error.hh b/src/libgamma-error.hh
index 5fe1cbc..12550f2 100644
--- a/src/libgamma-error.hh
+++ b/src/libgamma-error.hh
@@ -20,6 +20,7 @@
#include <string>
+#include <exception>
#include "libgamma-native.hh"
@@ -135,6 +136,48 @@ namespace libgamma
*/
extern GroupName group_name;
+
+ /**
+ * Libgamma exception class.
+ */
+ class LibgammaException : public std::exception
+ {
+ public:
+ /**
+ * Constructor.
+ *
+ * @param error_code The error code.
+ */
+ LibgammaException(int error_code) throw();
+
+ /**
+ * Destructor.
+ */
+ virtual ~LibgammaException() throw();
+
+ /**
+ * Get the error as a string.
+ */
+ virtual const char* what() const throw();
+
+ /**
+ * The error code.
+ */
+ int error_code;
+
+ };
+
+
+ /**
+ * Create an exception from an error code
+ * that may come from `errno.h` or be a
+ * `libgamma` error code.
+ *
+ * @param error_code The error code.
+ * @return The error object.
+ */
+ LibgammaException create_error(int error_code);
+
}