From 20e0f6744200e48c776d11db681ecab2fb2baa35 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Fri, 5 Aug 2011 17:49:46 +0300 Subject: [PATCH] Add a constructor for system_error that takes error message instead of code --- source/core/systemerror.cpp | 6 ++++++ source/core/systemerror.h | 1 + 2 files changed, 7 insertions(+) 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_; } -- 2.45.2