mirror of
https://github.com/pocoproject/poco.git
synced 2025-04-01 09:24:55 +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/NamedEvent_WIN32.h"
|
||||||
|
#include "Poco/Error.h"
|
||||||
#include "Poco/Exception.h"
|
#include "Poco/Exception.h"
|
||||||
|
#include "Poco/Format.h"
|
||||||
|
|
||||||
|
|
||||||
namespace Poco {
|
namespace Poco {
|
||||||
@ -26,7 +28,10 @@ NamedEventImpl::NamedEventImpl(const std::string& name):
|
|||||||
{
|
{
|
||||||
_event = CreateEventA(NULL, FALSE, FALSE, _name.c_str());
|
_event = CreateEventA(NULL, FALSE, FALSE, _name.c_str());
|
||||||
if (!_event)
|
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/NamedEvent_WIN32U.h"
|
||||||
|
#include "Poco/Error.h"
|
||||||
#include "Poco/Exception.h"
|
#include "Poco/Exception.h"
|
||||||
|
#include "Poco/Format.h"
|
||||||
#include "Poco/UnicodeConverter.h"
|
#include "Poco/UnicodeConverter.h"
|
||||||
|
|
||||||
|
|
||||||
@ -28,7 +30,10 @@ NamedEventImpl::NamedEventImpl(const std::string& name):
|
|||||||
UnicodeConverter::toUTF16(_name, _uname);
|
UnicodeConverter::toUTF16(_name, _uname);
|
||||||
_event = CreateEventW(NULL, FALSE, FALSE, _uname.c_str());
|
_event = CreateEventW(NULL, FALSE, FALSE, _uname.c_str());
|
||||||
if (!_event)
|
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