Skip to content
Snippets Groups Projects
Commit d652654e authored by Christoph Lehmann's avatar Christoph Lehmann Committed by Dmitri Naumov
Browse files

[BL] Issue error if vector is not parsed fully.

Returns boost::none in the case of error.
parent f036b2c7
No related branches found
No related tags found
No related merge requests found
......@@ -81,6 +81,17 @@ boost::optional<std::vector<T>> ConfigTree::getConfParamOptionalImpl(
T value;
while (sstr >> value)
result.push_back(value);
if (!sstr.eof()) // The stream is not read until the end, must be an
// error. result contains number of read values.
{
error("Value for key <" + param + "> `" +
shortString(sstr.str()) +
"' not convertible to a vector of the desired type."
" Could not convert token no. " +
std::to_string(result.size() + 1) + ".");
return boost::none;
}
return boost::make_optional(result);
}
......
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