diff options
| author | 2022-12-13 10:38:02 +0000 | |
|---|---|---|
| committer | 2022-12-13 10:45:33 +0000 | |
| commit | 86058dc504448656d9fd92d3022cea0ccf80946d (patch) | |
| tree | 9d4dcf081da3269102ca75c32dc04a3744251f8a /src/modulemanager.cpp | |
| parent | Tell an oper when the X-line they were trying to match is too wide. (diff) | |
Show the system error message when loading modules fails.
Diffstat (limited to 'src/modulemanager.cpp')
| -rw-r--r-- | src/modulemanager.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/modulemanager.cpp b/src/modulemanager.cpp index 987cbb04c..f44a7ca7b 100644 --- a/src/modulemanager.cpp +++ b/src/modulemanager.cpp @@ -133,7 +133,15 @@ void ModuleManager::LoadCoreModules(std::map<std::string, ServiceList>& servicem std::vector<std::string> files; if (!FileSystem::GetFileList(ServerInstance->Config->Paths.Module, files, "core_*.so")) { - std::cout << "failed!" << std::endl; +#ifdef _WIN32 + DWORD errcode = GetLastError(); + char errmsg[500]; + if (FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, errcode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR)errmsg, _countof(errmsg), NULL) == 0) + sprintf_s(errmsg, _countof(errmsg), "Error code: %u", errcode); +#else + char* errmsg = strerror(errno); +#endif + std::cout << "failed: " << errmsg << "!" << std::endl; ServerInstance->Exit(EXIT_STATUS_MODULE); } |
