From 3e791083459e23b8be123c592a9e4089ac5c0143 Mon Sep 17 00:00:00 2001 From: Oliver Hamlet Date: Fri, 16 May 2025 17:12:44 +0100 Subject: [PATCH] Throw PluginNotLoadedError from SortPlugins() --- src/api/game/game.cpp | 5 +++-- src/tests/api/interface/game_interface_test.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/api/game/game.cpp b/src/api/game/game.cpp index 65791016..66691d08 100644 --- a/src/api/game/game.cpp +++ b/src/api/game/game.cpp @@ -34,6 +34,7 @@ #include "api/api_database.h" #include "api/helpers/logging.h" #include "api/sorting/plugin_sort.h" +#include "loot/exception/plugin_not_loaded_error.h" #ifdef _WIN32 #ifndef UNICODE @@ -270,8 +271,8 @@ std::vector Game::SortPlugins( for (const auto& pluginFilename : pluginFilenames) { const auto plugin = cache_.GetPlugin(pluginFilename); if (plugin == nullptr) { - throw std::invalid_argument("The plugin \"" + pluginFilename + - "\" has not been loaded."); + throw PluginNotLoadedError("The plugin \"" + pluginFilename + + "\" has not been loaded."); } plugins.push_back(plugin.get()); diff --git a/src/tests/api/interface/game_interface_test.h b/src/tests/api/interface/game_interface_test.h index 0a1173d0..a077fe37 100644 --- a/src/tests/api/interface/game_interface_test.h +++ b/src/tests/api/interface/game_interface_test.h @@ -467,7 +467,7 @@ TEST_P(GameInterfaceTest, TEST_P(GameInterfaceTest, sortPluginsShouldThrowIfAGivenPluginIsNotLoaded) { std::vector plugins{blankEsp, blankDifferentEsp}; - EXPECT_THROW(handle_->SortPlugins(plugins), std::invalid_argument); + EXPECT_THROW(handle_->SortPlugins(plugins), PluginNotLoadedError); } TEST_P(GameInterfaceTest, clearLoadedPluginsShouldClearThePluginsCache) {