Fix exception handler for --library on OS X

refs #8227
This commit is contained in:
Gunnar Beutner 2015-02-13 09:19:01 +01:00
parent 9fe52d0dc1
commit 0f2598b43b
1 changed files with 5 additions and 15 deletions

View File

@ -264,25 +264,15 @@ int Main(void)
}
if (vm.count("library")) {
BOOST_FOREACH(const String& libraryName, vm["library"].as<std::vector<std::string> >())
{
BOOST_FOREACH(const String& libraryName, vm["library"].as<std::vector<std::string> >()) {
try {
(void) Utility::LoadExtensionLibrary(libraryName);
}
#ifdef _WIN32
catch (win32_error &ex) {
if (int const * err = boost::get_error_info<errinfo_win32_error>(ex)) {
Log(LogCritical, "icinga-app", "Could not load library \"" + libraryName + "\"");
} catch (const std::exception& ex) {
Log(LogCritical, "icinga-app")
<< "Could not load library \"" << libraryName << "\": " << DiagnosticInformation(ex);
return EXIT_FAILURE;
}
}
#else /*_WIN32*/
catch (std::runtime_error &ex) {
Log(LogCritical, "icinga-app", "Could not load library \"" + libraryName + "\"");
return EXIT_FAILURE;
}
#endif /*_WIN32*/
}
}
if (!command || vm.count("help") || vm.count("version")) {