From c39ad4da6521f547cf60aa560c899b83bc815a36 Mon Sep 17 00:00:00 2001 From: Markus Kolb Date: Fri, 11 Jul 2014 15:03:06 +0200 Subject: [PATCH] NamedEvent_WIN32 be more verbose on SystemException with GetLastError() --- Foundation/src/NamedEvent_WIN32.cpp | 7 ++++++- Foundation/src/NamedEvent_WIN32U.cpp | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Foundation/src/NamedEvent_WIN32.cpp b/Foundation/src/NamedEvent_WIN32.cpp index 5fcdfaada..6f7bb5419 100644 --- a/Foundation/src/NamedEvent_WIN32.cpp +++ b/Foundation/src/NamedEvent_WIN32.cpp @@ -15,7 +15,9 @@ #include "Poco/NamedEvent_WIN32.h" +#include "Poco/Error.h" #include "Poco/Exception.h" +#include "Poco/Format.h" namespace Poco { @@ -26,7 +28,10 @@ NamedEventImpl::NamedEventImpl(const std::string& name): { _event = CreateEventA(NULL, FALSE, FALSE, _name.c_str()); if (!_event) - throw SystemException("cannot create named event", _name); + { + DWORD dwRetVal = GetLastError(); + throw SystemException(format("cannot create named event %s [Error %d: %s]", _name, (int)dwRetVal, Error::getMessage(dwRetVal))); + } } diff --git a/Foundation/src/NamedEvent_WIN32U.cpp b/Foundation/src/NamedEvent_WIN32U.cpp index ad3202cd0..5849bc685 100644 --- a/Foundation/src/NamedEvent_WIN32U.cpp +++ b/Foundation/src/NamedEvent_WIN32U.cpp @@ -15,7 +15,9 @@ #include "Poco/NamedEvent_WIN32U.h" +#include "Poco/Error.h" #include "Poco/Exception.h" +#include "Poco/Format.h" #include "Poco/UnicodeConverter.h" @@ -28,7 +30,10 @@ NamedEventImpl::NamedEventImpl(const std::string& name): UnicodeConverter::toUTF16(_name, _uname); _event = CreateEventW(NULL, FALSE, FALSE, _uname.c_str()); if (!_event) - throw SystemException("cannot create named event", _name); + { + DWORD dwRetVal = GetLastError(); + throw SystemException(format("cannot create named event %s [Error %d: %s]", _name, (int)dwRetVal, Error::getMessage(dwRetVal))); + } }