]> git.tdb.fi Git - libs/core.git/blobdiff - source/core/systemerror.h
New system_error exception class
[libs/core.git] / source / core / systemerror.h
diff --git a/source/core/systemerror.h b/source/core/systemerror.h
new file mode 100644 (file)
index 0000000..4b7493d
--- /dev/null
@@ -0,0 +1,26 @@
+#ifndef MSP_CORE_SYSTEMERROR_H_
+#define MSP_CORE_SYSTEMERROR_H_
+
+#include <stdexcept>
+#include <string>
+
+namespace Msp {
+
+class system_error: public std::runtime_error
+{
+private:
+       int code_;
+
+public:
+       system_error(const std::string &, int = -1);
+       virtual ~system_error() throw() { }
+
+       int code() const throw() { return code_; }
+
+private:
+       static std::string get_message(int);
+};
+
+} // namespace Msp
+
+#endif