fix(c++): don't throw outside of the try catch block in nothrow function

Reported by cppcheck

Signed-off-by: Samuel Gaist <samuel.gaist@idiap.ch>
This commit is contained in:
Samuel Gaist
2024-02-13 23:32:40 +01:00
committed by poiana
parent f3491d62c9
commit e18acc361e

View File

@@ -330,6 +330,8 @@ static void process_inspector_events(
source_sync_context* sync,
run_result* res) noexcept
{
run_result result;
try
{
double duration;
@@ -342,7 +344,7 @@ static void process_inspector_events(
duration = ((double)clock()) / CLOCKS_PER_SEC;
*res = do_inspect(s, inspector, source, statsw, sdropmgr, check_drops_timeouts,
result = do_inspect(s, inspector, source, statsw, sdropmgr, check_drops_timeouts,
uint64_t(s.options.duration_to_tot*ONE_SECOND_IN_NS),
num_evts);
@@ -373,13 +375,21 @@ static void process_inspector_events(
}
catch(const std::exception& e)
{
*res = run_result::fatal(e.what());
result = run_result::fatal(e.what());
}
if (sync)
{
sync->finish();
try {
sync->finish();
}
catch(const std::exception& e)
{
result = run_result::merge(result, run_result::fatal(e.what()));
}
}
*res = result;
}
static falco::app::run_result init_stats_writer(