1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

exceptions: show location of configuration error

This commit is contained in:
Steffen Vogel 2020-08-18 09:05:02 +02:00
parent c855ac37c3
commit 8c7bde39c8

View file

@ -107,7 +107,9 @@ public:
std::runtime_error(what),
id(i),
setting(s)
{ }
{
error.position = -1;
}
template<typename... Args>
ConfigError(json_t *s, const std::string &i, const std::string &what, Args&&... args) :
@ -146,6 +148,10 @@ public:
ss << std::runtime_error::what() << std::endl;
ss << " Please consult the user documentation for details: " << docUri();
if (error.position >= 0) {
ss << std::endl << " " << error.text << " in " << error.source << ":" << error.line << ":" << error.column;
}
auto str = new std::string(ss.str());
return str->c_str();