From 2a35bae655a066e20f5977dd522d7162ca50bafc Mon Sep 17 00:00:00 2001 From: uramer Date: Wed, 1 Feb 2023 16:24:45 +0100 Subject: [PATCH] Use range_error for invalid indexes --- components/lua_ui/content.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/components/lua_ui/content.hpp b/components/lua_ui/content.hpp index c3da9e7365..310d0b9cbe 100644 --- a/components/lua_ui/content.hpp +++ b/components/lua_ui/content.hpp @@ -45,7 +45,7 @@ namespace LuaUi::Content if (index <= size()) mTable[toLua(index)] = table; else - throw std::domain_error("Invalid Content index"); + throw std::range_error("Invalid Content index"); } void insert(size_t index, const sol::table& table) { callMethod("insert", toLua(index), table); } @@ -54,14 +54,14 @@ namespace LuaUi::Content if (index < size()) return mTable.get(toLua(index)); else - throw std::domain_error("Invalid Content index"); + throw std::range_error("Invalid Content index"); } sol::table at(std::string_view name) const { if (indexOf(name).has_value()) return mTable.get(name); else - throw std::domain_error("Invalid Content key"); + throw std::range_error("Invalid Content key"); } void remove(size_t index) { @@ -70,7 +70,7 @@ namespace LuaUi::Content mTable[sol::metatable_key][sol::meta_function::new_index].get()( mTable, toLua(index), sol::nil); else - throw std::domain_error("Invalid Content index"); + throw std::range_error("Invalid Content index"); } void remove(std::string_view name) {