Skip to content

Commit

Permalink
split try catch for parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
payetvin committed Dec 31, 2024
1 parent abb4e33 commit 6df9b65
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/solver/modeler/loadFiles/readParameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,24 @@ namespace Antares::Solver::LoadFiles
ModelerParameters loadParameters(const fs::path& studyPath)
{
std::string filename = "parameters.yml";
std::string paramStr;
try
{
const std::string paramStr = IO::readFile(studyPath / filename);
return parseModelerParameters(paramStr);
paramStr = IO::readFile(studyPath / filename);
}
catch (const YAML::Exception& e)
catch (const std::runtime_error& e)
{
handleYamlError(e, filename);
handleRuntimeError(e, filename);
throw ErrorLoadingYaml(e.what());
}
catch (const std::runtime_error& e)

try
{
handleRuntimeError(e, filename);
return parseModelerParameters(paramStr);
}
catch (const YAML::Exception& e)
{
handleYamlError(e, filename);
throw ErrorLoadingYaml(e.what());
}
}
Expand Down

0 comments on commit 6df9b65

Please sign in to comment.