| 11 | namespace engine::runtime { |
| 12 | |
| 13 | namespace { |
| 14 | |
| 15 | int parse_int_value(const std::string & value, std::string_view key) { |
| 16 | size_t parsed = 0; |
| 17 | const long long out = std::stoll(value, &parsed); |
| 18 | if (parsed != value.size()) { |
| 19 | throw std::runtime_error(std::string(key) + " must be an integer"); |
| 20 | } |
| 21 | if (out < std::numeric_limits<int>::min() || out > std::numeric_limits<int>::max()) { |
| 22 | throw std::runtime_error(std::string(key) + " is outside int range"); |
| 23 | } |
| 24 | return static_cast<int>(out); |
| 25 | } |
| 26 |
no test coverage detected