| 23 | auto parse_number(const std::string & value, std::string_view key, std::string_view kind, Parse parse) { |
| 24 | size_t parsed = 0; |
| 25 | try { |
| 26 | const auto out = parse(value, &parsed); |
| 27 | if (parsed == value.size()) { |
| 28 | return out; |
| 29 | } |
| 30 | } catch (const std::invalid_argument &) { |
| 31 | } catch (const std::out_of_range &) { |
| 32 | throw InvalidRequestError(std::string(key) + " is out of range"); |
| 33 | } |
| 34 | throw InvalidRequestError(std::string(key) + " must be " + std::string(kind)); |
| 35 | } |
no test coverage detected