mirror of
				https://github.com/Telecominfraproject/wlan-cloud-lib-poco.git
				synced 2025-10-30 18:17:50 +00:00 
			
		
		
		
	feat(SharedLibrary): add more detailed error description when LoadLibrary fails
This commit is contained in:
		| @@ -16,6 +16,9 @@ | |||||||
| #include "Poco/UnicodeConverter.h" | #include "Poco/UnicodeConverter.h" | ||||||
| #include "Poco/Path.h" | #include "Poco/Path.h" | ||||||
| #include "Poco/UnWindows.h" | #include "Poco/UnWindows.h" | ||||||
|  | #include "Poco/Error.h" | ||||||
|  | #include "Poco/Format.h" | ||||||
|  | #include "Poco/String.h" | ||||||
|  |  | ||||||
|  |  | ||||||
| namespace Poco { | namespace Poco { | ||||||
| @@ -48,7 +51,13 @@ void SharedLibraryImpl::loadImpl(const std::string& path, int /*flags*/) | |||||||
| 	std::wstring upath; | 	std::wstring upath; | ||||||
| 	UnicodeConverter::toUTF16(path, upath); | 	UnicodeConverter::toUTF16(path, upath); | ||||||
| 	_handle = LoadLibraryExW(upath.c_str(), 0, flags); | 	_handle = LoadLibraryExW(upath.c_str(), 0, flags); | ||||||
| 	if (!_handle) throw LibraryLoadException(path); | 	if (!_handle) | ||||||
|  | 	{ | ||||||
|  | 		int errn = static_cast<int>(Error::last()); | ||||||
|  | 		std::string err; | ||||||
|  | 		Poco::format(err, "Error %d while loading [%s]: [%s]", errn, path, Poco::trim(Error::getMessage(errn))); | ||||||
|  | 		throw LibraryLoadException(err); | ||||||
|  | 	} | ||||||
| 	_path = path; | 	_path = path; | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Alex Fabijanic
					Alex Fabijanic