mirror of
https://github.com/matrix-construct/construct
synced 2024-12-28 08:24:08 +01:00
fixup! ircd: Add labeled-params tokenizer; fix bad lexical cast exception type.
This commit is contained in:
parent
1016e993e9
commit
4b7372c4a8
1 changed files with 11 additions and 4 deletions
|
@ -307,7 +307,7 @@ const try
|
||||||
}
|
}
|
||||||
catch(const bad_lex_cast &e)
|
catch(const bad_lex_cast &e)
|
||||||
{
|
{
|
||||||
throw invalid("parameter #%zu \"%s\"", i, name(i));
|
throw invalid("parameter #%zu <%s>", i, name(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
|
@ -319,7 +319,7 @@ const try
|
||||||
}
|
}
|
||||||
catch(const bad_lex_cast &e)
|
catch(const bad_lex_cast &e)
|
||||||
{
|
{
|
||||||
throw invalid("parameter #%zu \"%s\"", i, name(i));
|
throw invalid("parameter #%zu <%s>", i, name(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline ircd::string_view
|
inline ircd::string_view
|
||||||
|
@ -330,7 +330,7 @@ const try
|
||||||
}
|
}
|
||||||
catch(const std::out_of_range &e)
|
catch(const std::out_of_range &e)
|
||||||
{
|
{
|
||||||
throw missing("required parameter #%zu \"%s\"", i, name(i));
|
throw missing("required parameter #%zu <%s>", i, name(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline ircd::string_view
|
inline ircd::string_view
|
||||||
|
@ -344,7 +344,7 @@ inline const char *
|
||||||
ircd::params::name(const size_t &i)
|
ircd::params::name(const size_t &i)
|
||||||
const
|
const
|
||||||
{
|
{
|
||||||
return names.size() > i? *std::next(begin(names), i) : "<unlabeled>";
|
return names.size() > i? *std::next(begin(names), i) : "<unnamed>";
|
||||||
}
|
}
|
||||||
|
|
||||||
template<size_t N>
|
template<size_t N>
|
||||||
|
@ -523,3 +523,10 @@ ircd::iequals(const string_view &a,
|
||||||
return tolower(a) == tolower(b);
|
return tolower(a) == tolower(b);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
ircd::string_view
|
||||||
|
ircd::lex_cast(const T &t)
|
||||||
|
{
|
||||||
|
return lex_cast<T>(t, nullptr, 0);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue