]> git.tdb.fi Git - libs/core.git/blobdiff - source/core/systemerror.cpp
Fix Windows compilation
[libs/core.git] / source / core / systemerror.cpp
index 6d1d876c1f3e00fb94886a1612454af7443bf01a..1ccee74ed4a80139c77e1e013567465f4325906e 100644 (file)
@@ -5,6 +5,7 @@
 #include <cerrno>
 #include <cstring>
 #endif
+#include <limits>
 #include "systemerror.h"
 
 using namespace std;
@@ -16,6 +17,11 @@ system_error::system_error(const string &w, int c):
        code_(c)
 { }
 
+system_error::system_error(const string &w, const string &e):
+       runtime_error(w+": "+e),
+       code_(numeric_limits<int>::min())
+{ }
+
 string system_error::get_message(int c)
 {
 #ifdef WIN32
@@ -26,7 +32,7 @@ string system_error::get_message(int c)
        if(FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, 0, c, 0, msg, sizeof(msg), 0))
                return msg;
        else
-               return lexical_cast(c, Fmt().hex());
+               return lexical_cast<string>(c, Fmt().hex());
 #else
        if(c==-1)
                c = errno;