mirror of
https://github.com/pocoproject/poco.git
synced 2025-03-30 07:26:33 +02:00
NamedEvent_WIN32 be more verbose on SystemException with GetLastError()
This commit is contained in:
parent
37691144df
commit
c39ad4da65
@ -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)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -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)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user