Exceptions: All of smocore likely now uses exceptions
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user