diff options
author | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2024-03-05 18:11:00 +0100 |
---|---|---|
committer | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2024-03-07 09:34:01 +0100 |
commit | fc11ad845a3d3d4c0d708b715cf9fb5e4c8fbd07 (patch) | |
tree | 5542d40cde2b2d2297c6b221bc29ca50abaa99f2 /src/other_tools/just_mr/setup_utils.cpp | |
parent | ae16d8be16e4104eaab130b0f1e18883e22bf742 (diff) | |
download | justbuild-fc11ad845a3d3d4c0d708b715cf9fb5e4c8fbd07.tar.gz |
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.
Diffstat (limited to 'src/other_tools/just_mr/setup_utils.cpp')
-rw-r--r-- | src/other_tools/just_mr/setup_utils.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
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<Configuration>(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); } } |