]> granicus.if.org Git - icinga2/commitdiff
Improve error message when trying to open a config file.
authorGerd von Egidy <gerd@egidy.de>
Tue, 29 Apr 2014 22:23:20 +0000 (00:23 +0200)
committerGunnar Beutner <gunnar.beutner@netways.de>
Tue, 29 Apr 2014 22:36:49 +0000 (00:36 +0200)
Fixes #5666

Signed-off-by: Gunnar Beutner <gunnar.beutner@netways.de>
lib/config/configcompiler.cpp

index 5e38c3c87782138859dc5ac9a9716dffd8f9c987..5a58e12b3d78c1dc43898421c6130d427e7814f1 100644 (file)
@@ -22,6 +22,7 @@
 #include "base/logger_fwd.h"
 #include "base/utility.h"
 #include "base/context.h"
+#include "base/exception.h"
 #include <sstream>
 #include <fstream>
 #include <boost/foreach.hpp>
@@ -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);