From: Gerd von Egidy Date: Tue, 29 Apr 2014 22:23:20 +0000 (+0200) Subject: Improve error message when trying to open a config file. X-Git-Tag: v0.0.11~108 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6ac851ca108638fbfede38bc97959be0a1595add;p=icinga2 Improve error message when trying to open a config file. Fixes #5666 Signed-off-by: Gunnar Beutner --- diff --git a/lib/config/configcompiler.cpp b/lib/config/configcompiler.cpp index 5e38c3c87..5a58e12b3 100644 --- a/lib/config/configcompiler.cpp +++ b/lib/config/configcompiler.cpp @@ -22,6 +22,7 @@ #include "base/logger_fwd.h" #include "base/utility.h" #include "base/context.h" +#include "base/exception.h" #include #include #include @@ -190,7 +191,10 @@ void ConfigCompiler::CompileFile(const String& path) stream.open(path.CStr(), std::ifstream::in); if (!stream) - BOOST_THROW_EXCEPTION(std::invalid_argument("Could not open config file: " + path)); + BOOST_THROW_EXCEPTION(posix_error() + << boost::errinfo_api_function("std::ifstream::open") + << boost::errinfo_errno(errno) + << boost::errinfo_file_name(path)); Log(LogInformation, "config", "Compiling config file: " + path);