mirror of
				https://github.com/pocoproject/poco.git
				synced 2025-10-25 18:22:59 +02:00 
			
		
		
		
	NamedEvent_WIN32 be more verbose on SystemException with GetLastError()
This commit is contained in:
		| @@ -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))); | ||||
| 	} | ||||
| } | ||||
|  | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Markus Kolb
					Markus Kolb