Exceptions: All of smocore likely now uses exceptions

This commit is contained in:
2026-06-07 19:37:50 -04:00
parent 241e8a6798
commit b2644f17c6
8 changed files with 304 additions and 242 deletions
+14 -1
View File
@@ -230,7 +230,7 @@ StimBuffApiManager::getStimBuffApiLib(const std::string& libraryPath)
}
std::optional<std::shared_ptr<StimBuffApiLib>>
StimBuffApiManager::getStimBuffApiLibByApiName(const std::string& apiName)
StimBuffApiManager::findStimBuffApiLibByApiName(const std::string& apiName)
{
auto &libs = getInstance().s.rsrc.stimBuffApiLibs;
auto it = std::find_if(libs.begin(), libs.end(),
@@ -243,6 +243,19 @@ StimBuffApiManager::getStimBuffApiLibByApiName(const std::string& apiName)
return std::nullopt;
}
StimBuffApiLib &StimBuffApiManager::getStimBuffApiLibByApiName(
const std::string& apiName)
{
auto libOpt = findStimBuffApiLibByApiName(apiName);
if (!libOpt)
{
throw std::runtime_error(
std::string(__func__) + ": No library for API '" + apiName + "'");
}
return *libOpt.value();
}
void StimBuffApiManager::unloadStimBuffApiLib(const std::string& libraryPath)
{
auto &libs = getInstance().s.rsrc.stimBuffApiLibs;