From: Mikko Rasa Date: Fri, 5 Aug 2011 14:49:46 +0000 (+0300) Subject: Add a constructor for system_error that takes error message instead of code X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=20e0f6744200e48c776d11db681ecab2fb2baa35;p=libs%2Fcore.git Add a constructor for system_error that takes error message instead of code --- diff --git a/source/core/systemerror.cpp b/source/core/systemerror.cpp index 6d1d876..8d8844a 100644 --- a/source/core/systemerror.cpp +++ b/source/core/systemerror.cpp @@ -5,6 +5,7 @@ #include #include #endif +#include #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::min()) +{ } + string system_error::get_message(int c) { #ifdef WIN32 diff --git a/source/core/systemerror.h b/source/core/systemerror.h index 4b7493d..c6b516a 100644 --- a/source/core/systemerror.h +++ b/source/core/systemerror.h @@ -13,6 +13,7 @@ private: public: system_error(const std::string &, int = -1); + system_error(const std::string &, const std::string &); virtual ~system_error() throw() { } int code() const throw() { return code_; }