mirror of https://github.com/Icinga/icinga2.git
Improve error message when trying to open a config file.
Fixes #5666 Signed-off-by: Gunnar Beutner <gunnar.beutner@netways.de>
This commit is contained in:
parent
49d2932d30
commit
6ac851ca10
|
@ -22,6 +22,7 @@
|
||||||
#include "base/logger_fwd.h"
|
#include "base/logger_fwd.h"
|
||||||
#include "base/utility.h"
|
#include "base/utility.h"
|
||||||
#include "base/context.h"
|
#include "base/context.h"
|
||||||
|
#include "base/exception.h"
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <boost/foreach.hpp>
|
#include <boost/foreach.hpp>
|
||||||
|
@ -190,7 +191,10 @@ void ConfigCompiler::CompileFile(const String& path)
|
||||||
stream.open(path.CStr(), std::ifstream::in);
|
stream.open(path.CStr(), std::ifstream::in);
|
||||||
|
|
||||||
if (!stream)
|
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);
|
Log(LogInformation, "config", "Compiling config file: " + path);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue