From 429ed024832a1f3d0eb383983d666bc91dd99f77 Mon Sep 17 00:00:00 2001 From: Username404-59 Date: Fri, 8 Oct 2021 13:07:13 +0200 Subject: [PATCH] Don't output useless new lines in main.cpp --- src/headers/Yerbacon.hpp | 4 +++- src/main.cpp | 5 ++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/headers/Yerbacon.hpp b/src/headers/Yerbacon.hpp index 568c534..a7d56a5 100644 --- a/src/headers/Yerbacon.hpp +++ b/src/headers/Yerbacon.hpp @@ -40,7 +40,9 @@ namespace Yerbacon { [[nodiscard]] const char* what() const noexcept final { return exceptionCause.data(); } - explicit Exception(const std::string_view& cause): exceptionCause(cause) {} + explicit Exception(const std::string_view& cause): exceptionCause(cause) { + if (!cause.ends_with('\n')) exceptionCause += '\n'; + } Exception(const std::string_view& cause, unsigned long line): Exception(('L' + std::to_string(line) + ": ").append(cause)) {} }; } diff --git a/src/main.cpp b/src/main.cpp index 361f78f..f6a24a8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -68,11 +68,10 @@ int main(int argc, char* argv[]) { for_each(Units.begin(), Units.end(), [&printResult](future>>& currentFuture) { const auto&& result = currentFuture.get(); if (not result.second.has_value()) { - if (printResult) cout << result.first; + if (printResult) cout << result.first << '\n'; } else { - cout << "Compilation of " << result.first << " has failed with the following error:\n" << result.second.value().what(); + cout << "Compilation of " << result.first << " has failed with the following error:\n" << result.second.value().what() << '\n'; } - cout << "\n\n"; }); } else cout << "No valid file provided.\n"; return EXIT_SUCCESS;