Skip to content
Snippets Groups Projects
Commit 1e770925 authored by Dr. Felix Tobias Schindler's avatar Dr. Felix Tobias Schindler
Browse files

[common.configuration] added some meaningful error messages

parent d5be34dc
No related branches found
No related tags found
No related merge requests found
......@@ -525,13 +525,22 @@ private:
const size_t size, const size_t cols) const
{
std::string valstring = BaseType::get(key, toString(def));
T val = fromString<T>(valstring, size, cols);
if (validator(val))
return val;
else {
std::stringstream ss;
validator.print(ss);
DUNE_THROW(Exceptions::configuration_error, ss.str());
try {
T val = fromString<T>(valstring, size, cols);
if (validator(val))
return val;
else
DUNE_THROW(Exceptions::configuration_error, validator.msg());
} catch (boost::bad_lexical_cast& e) {
DUNE_THROW(Exceptions::external_error,
"Error in boost while converting the string '" << valstring << "' to type '" << Typename<T>::value()
<< "':\n"
<< e.what());
} catch (std::exception& e) {
DUNE_THROW(Exceptions::external_error,
"Error in the stl while converting the string '" << valstring << "' to type '" << Typename<T>::value()
<< "':\n"
<< e.what());
}
} // ... get_valid_value(...)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment