From ab46e6db213d1dcb37661acd924e2838979795a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edu=20G=C3=B3mez=20Escandell?= Date: Tue, 5 Dec 2023 12:55:09 +0100 Subject: [PATCH] Make any failed day cause the return value to be non-zero --- 2023/xmaslib/solution/solution.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/2023/xmaslib/solution/solution.cpp b/2023/xmaslib/solution/solution.cpp index f6f32b1..048de0c 100644 --- a/2023/xmaslib/solution/solution.cpp +++ b/2023/xmaslib/solution/solution.cpp @@ -16,7 +16,9 @@ solution::duration solution::time() const { } bool solution::run(bool verbose) noexcept { - if(verbose) + bool success = true; + + if (verbose) xlog::info("Day {}", this->day()); try { @@ -42,6 +44,7 @@ bool solution::run(bool verbose) noexcept { } } catch (std::runtime_error &err) { xlog::error("Part 1 failed with message: {}", err.what()); + success = false; } catch (...) { xlog::error("Part 1 failed with no message"); return false; @@ -60,12 +63,13 @@ bool solution::run(bool verbose) noexcept { } } catch (std::runtime_error &err) { xlog::error("Part 2 failed with message: {}", err.what()); + success = false; } catch (...) { xlog::error("Part 2 failed with no message"); return false; } - return true; + return success; } void solution::set_input(std::string_view path) { this->data_path = path; }