diff --git a/common/include/villas/exceptions.hpp b/common/include/villas/exceptions.hpp index 8226fddcf..d31b2dab2 100644 --- a/common/include/villas/exceptions.hpp +++ b/common/include/villas/exceptions.hpp @@ -34,9 +34,9 @@ #include -#ifdef LIBCONFIG_FOUND -#include -#endif /* LIBCONFIG_FOUND */ +#ifdef WITH_CONFIG + #include +#endif /* WITH_CONFIG */ namespace villas { @@ -99,14 +99,29 @@ protected: public: template - ConfigError(json_t *s, const std::string &i, const std::string &what = "Failed to parse configuration", Args&&... args) : + ConfigError(json_t *s, const std::string &i, const std::string &what = "Failed to parse configuration") : + std::runtime_error(what), + id(i), + setting(s) + { } + + template + ConfigError(json_t *s, const std::string &i, const std::string &what, Args&&... args) : std::runtime_error(fmt::format(what, std::forward(args)...)), id(i), setting(s) { } template - ConfigError(json_t *s, const json_error_t &e, const std::string &i, const std::string &what = "Failed to parse configuration", Args&&... args) : + ConfigError(json_t *s, const json_error_t &e, const std::string &i, const std::string &what = "Failed to parse configuration") : + std::runtime_error(what), + id(i), + setting(s), + error(e) + { } + + template + ConfigError(json_t *s, const json_error_t &e, const std::string &i, const std::string &what, Args&&... args) : std::runtime_error(fmt::format(what, std::forward(args)...)), id(i), setting(s),