]> git.tdb.fi Git - libs/core.git/blobdiff - source/core/except.cpp
Add a "where" property to Exception class
[libs/core.git] / source / core / except.cpp
index ddd2cb5167d57f0e3f5df614a8caf3ad3b68dc50..0ae2e59bd9ba339a78d7560ed13326ac6af83e45 100644 (file)
@@ -1,7 +1,7 @@
 /* $Id$
 
 This file is part of libmspcore
-Copyright © 2006-2007 Mikko Rasa, Mikkosoft Productions
+Copyright © 2006-200 Mikko Rasa, Mikkosoft Productions
 Distributed under the LGPL
 */
 
@@ -16,24 +16,27 @@ using namespace std;
 
 namespace Msp {
 
-Exception::Exception(const string &w_):
-       w(w_)
+Exception::Exception(const string &w):
+       wot(w)
 {
 #ifdef WITH_EXCEPTION_BACKTRACE
        bt=Debug::Backtrace::create();
 #endif
 }
 
+Exception &Exception::at(const std::string &w) throw()
+{
+       wer=w;
+       wot=wer+": "+wot;
+       return *this;
+}
+
+
 SystemError::SystemError(const string &w_, int e):
        Exception(build_what(w_, e)),
        err(e)
 { }
 
-KeyError::KeyError(const string &w_, const string &k):
-       Exception(w_+" ("+k+")"),
-       key(k)
-{ }
-
 string SystemError::build_what(const string &w, int e)
 {
        ostringstream buf;
@@ -50,4 +53,10 @@ string SystemError::build_what(const string &w, int e)
        return buf.str();
 }
 
+
+KeyError::KeyError(const string &w_, const string &k):
+       Exception(w_+" ("+k+")"),
+       key(k)
+{ }
+
 } // namespace Msp