+/* $Id$
+
+This file is part of libmspcore
+Copyright © 2006-2007 Mikko Rasa, Mikkosoft Productions
+Distributed under the LGPL
+*/
+#include <sstream>
+#include "except.h"
+
+using namespace std;
+
+namespace Msp {
+
+Exception::Exception(const string &w_):
+ w(w_)
+{
+#ifdef WITH_EXCEPTION_BACKTRACE
+ bt=Debug::Backtrace::create();
+#endif
+}
+
+SystemError::SystemError(const string &w_, int e):
+ Exception(build_what(w_, e)),
+ err(e)
+{ }
+
+string SystemError::build_what(const string &w, int e)
+{
+ ostringstream buf;
+ buf<<w<<": ";
+#ifdef WIN32
+ buf<<e;
+#else
+ buf<<strerror(e);
+#endif
+ return buf.str();
+}
+
+} // namespace Msp