Throw PluginNotLoadedError from SortPlugins()

This commit is contained in:
Oliver Hamlet
2025-06-07 17:05:48 +01:00
parent e90dffd518
commit 3e79108345
2 changed files with 4 additions and 3 deletions
+3 -2
View File
@@ -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<std::string> 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());
@@ -467,7 +467,7 @@ TEST_P(GameInterfaceTest,
TEST_P(GameInterfaceTest, sortPluginsShouldThrowIfAGivenPluginIsNotLoaded) {
std::vector<std::string> plugins{blankEsp, blankDifferentEsp};
EXPECT_THROW(handle_->SortPlugins(plugins), std::invalid_argument);
EXPECT_THROW(handle_->SortPlugins(plugins), PluginNotLoadedError);
}
TEST_P(GameInterfaceTest, clearLoadedPluginsShouldClearThePluginsCache) {