aboutsummaryrefslogtreecommitdiffstats
path: root/src/libgamma-error.hh
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-09-03 19:12:59 +0200
committerMattias Andrée <maandree@operamail.com>2014-09-03 19:12:59 +0200
commitae6072ece6ac02a0d2438d110af90cf6ca2f3f50 (patch)
treeb27c31cfe1cb02cf865e23d639c7c06a234b2f56 /src/libgamma-error.hh
parentlibgamma_group_gid and libgamma_group_name (diff)
downloadlibgammamm-ae6072ece6ac02a0d2438d110af90cf6ca2f3f50.tar.gz
libgammamm-ae6072ece6ac02a0d2438d110af90cf6ca2f3f50.tar.bz2
libgammamm-ae6072ece6ac02a0d2438d110af90cf6ca2f3f50.tar.xz
gamma ramps and exception class
Signed-off-by: Mattias Andrée <maandree@operamail.com>
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);
+
}