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:
Gerd von Egidy 2014-04-30 00:23:20 +02:00 committed by Gunnar Beutner
parent 49d2932d30
commit 6ac851ca10
1 changed files with 5 additions and 1 deletions

View File

@ -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);