about summary refs log tree commit diff
path: root/src/libutil/types.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/libutil/types.hh')
-rw-r--r--src/libutil/types.hh26
1 files changed, 15 insertions, 11 deletions
diff --git a/src/libutil/types.hh b/src/libutil/types.hh
index 513aae0392bc..fd50de00cce5 100644
--- a/src/libutil/types.hh
+++ b/src/libutil/types.hh
@@ -19,23 +19,18 @@ using std::vector;
 using boost::format;
 
 
-class Error : public std::exception
+/* BaseError should generally not be caught, as it has Interrupted as
+   a subclass. Catch Error instead. */
+class BaseError : public std::exception 
 {
 protected:
     string err;
 public:
-    Error(const format & f);
-    ~Error() throw () { };
+    BaseError(const format & f);
+    ~BaseError() throw () { };
     const char * what() const throw () { return err.c_str(); }
     const string & msg() const throw () { return err; }
-    Error & addPrefix(const format & f);
-};
-
-class SysError : public Error
-{
-public:
-    int errNo;
-    SysError(const format & f);
+    BaseError & addPrefix(const format & f);
 };
 
 #define MakeError(newClass, superClass) \
@@ -45,6 +40,15 @@ public:
         newClass(const format & f) : superClass(f) { }; \
     };
 
+MakeError(Error, BaseError)
+
+class SysError : public Error
+{
+public:
+    int errNo;
+    SysError(const format & f);
+};
+
 
 typedef list<string> Strings;
 typedef set<string> StringSet;