From fc11ad845a3d3d4c0d708b715cf9fb5e4c8fbd07 Mon Sep 17 00:00:00 2001 From: Paul Cristian Sarbu Date: Tue, 5 Mar 2024 18:11:00 +0100 Subject: exceptions handling: small improvements It is better to avoid empty catches when we have a reasonable way to log an (even unlikely) exception, even more so if memory allocations are involved. --- src/other_tools/just_mr/setup_utils.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/other_tools/just_mr/setup_utils.cpp') diff --git a/src/other_tools/just_mr/setup_utils.cpp b/src/other_tools/just_mr/setup_utils.cpp index 43d19709..915efe08 100644 --- a/src/other_tools/just_mr/setup_utils.cpp +++ b/src/other_tools/just_mr/setup_utils.cpp @@ -230,8 +230,11 @@ auto ReadConfiguration( try { return std::make_shared(Expression::FromJson(config)); - } catch (...) { - return nullptr; + } catch (std::exception const& e) { + Logger::Log(LogLevel::Error, + "Parsing configuration file failed with error:\n{}", + e.what()); + std::exit(kExitConfigError); } } -- cgit v1.2.3