about summary refs log tree commit diff
path: root/src/libutil
diff options
context:
space:
mode:
Diffstat (limited to 'src/libutil')
-rw-r--r--src/libutil/types.hh2
-rw-r--r--src/libutil/util.cc2
2 files changed, 3 insertions, 1 deletions
diff --git a/src/libutil/types.hh b/src/libutil/types.hh
index fd50de00cce5..f110188da151 100644
--- a/src/libutil/types.hh
+++ b/src/libutil/types.hh
@@ -24,12 +24,14 @@ using boost::format;
 class BaseError : public std::exception 
 {
 protected:
+    string prefix_; // used for location traces etc.
     string err;
 public:
     BaseError(const format & f);
     ~BaseError() throw () { };
     const char * what() const throw () { return err.c_str(); }
     const string & msg() const throw () { return err; }
+    const string & prefix() const throw () { return prefix_; }
     BaseError & addPrefix(const format & f);
 };
 
diff --git a/src/libutil/util.cc b/src/libutil/util.cc
index 1cb94215ee1b..b2fe7e627ef1 100644
--- a/src/libutil/util.cc
+++ b/src/libutil/util.cc
@@ -33,7 +33,7 @@ BaseError::BaseError(const format & f)
 
 BaseError & BaseError::addPrefix(const format & f)
 {
-    err = f.str() + err;
+    prefix_ = f.str() + prefix_;
     return *this;
 }