Skip to content

Commit

Permalink
Improve error message when trying to open a config file.
Browse files Browse the repository at this point in the history
Fixes #5666

Signed-off-by: Gunnar Beutner <gunnar.beutner@netways.de>
  • Loading branch information
gvegidy authored and gunnarbeutner committed Apr 29, 2014
1 parent 49d2932 commit 6ac851c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/config/configcompiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit 6ac851c

Please sign in to comment.