mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2025-07-01 23:35:41 +00:00
fix errors in Settings::set
This commit is contained in:
parent
f567645db6
commit
3a8f4ded29
@ -184,10 +184,10 @@ struct Settings {
|
||||
void set(Key key, std::string value) {
|
||||
auto map = SettingsMap.synchronize();
|
||||
if (!map->contains(key)) {
|
||||
throw std::logic_error { "Undefined setting key accessed in Settings::getAsString" };
|
||||
throw std::logic_error { "Undefined setting key accessed in Settings::set(std::string)" };
|
||||
}
|
||||
if (!std::holds_alternative<std::string>(map->at(key))) {
|
||||
throw std::logic_error { "Wrong value type in Settings::get: std::string" };
|
||||
throw std::logic_error { fmt::format("Wrong value type in Settings::set(std::string): index {}", map->at(key).index()) };
|
||||
}
|
||||
map->at(key) = value;
|
||||
}
|
||||
@ -195,10 +195,10 @@ struct Settings {
|
||||
void set(Key key, int value) {
|
||||
auto map = SettingsMap.synchronize();
|
||||
if (!map->contains(key)) {
|
||||
throw std::logic_error { "Undefined setting key accessed in Settings::getAsString" };
|
||||
throw std::logic_error { "Undefined setting key accessed in Settings::set(int)" };
|
||||
}
|
||||
if (!std::holds_alternative<int>(map->at(key))) {
|
||||
throw std::logic_error { "Wrong value type in Settings::get: std::string" };
|
||||
throw std::logic_error { fmt::format("Wrong value type in Settings::set(int): index {}", map->at(key).index()) };
|
||||
}
|
||||
map->at(key) = value;
|
||||
}
|
||||
@ -206,10 +206,10 @@ struct Settings {
|
||||
void set(Key key, bool value) {
|
||||
auto map = SettingsMap.synchronize();
|
||||
if (!map->contains(key)) {
|
||||
throw std::logic_error { "Undefined setting key accessed in Settings::getAsString" };
|
||||
throw std::logic_error { "Undefined setting key accessed in Settings::set(bool)" };
|
||||
}
|
||||
if (!std::holds_alternative<bool>(map->at(key))) {
|
||||
throw std::logic_error { "Wrong value type in Settings::get: std::string" };
|
||||
throw std::logic_error { fmt::format("Wrong value type in Settings::set(bool): index {}", map->at(key).index()) };
|
||||
}
|
||||
map->at(key) = value;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user