0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-29 10:12:39 +01:00

ircd::json: Simplify expectation error message.

This commit is contained in:
Jason Volk 2017-09-27 18:28:07 -07:00
parent 3649843950
commit bc9b0e990c

View file

@ -605,9 +605,11 @@ catch(const qi::expectation_failure<const char *> &e)
{
const auto rule(ircd::string(e.what_));
const long size(std::distance(e.first, e.last));
throw parse_error("Expected JSON %s. You input %zu invalid characters starting with `%s`.",
const long cat(std::distance(start, e.first));
throw parse_error("Expected %s. You input %zd invalid characters at position %zd: %s",
between(rule, "<", ">"),
size,
cat,
string_view(e.first, e.first + std::min(size, 64L)));
}
@ -647,9 +649,11 @@ catch(const qi::expectation_failure<const char *> &e)
{
const auto rule(ircd::string(e.what_));
const long size(std::distance(e.first, e.last));
throw parse_error("Expected JSON %s. You input %zu invalid characters starting with `%s`.",
const long cat(std::distance(string_view::data(), e.first));
throw parse_error("Expected %s. You input %zd invalid characters at position %zd: %s.",
between(rule, "<", ">"),
size,
cat,
string_view(e.first, e.first + std::min(size, 64L)));
}