diff --git a/src/Exception.hpp b/src/Exception.hpp index 176c8a5..8f7e910 100644 --- a/src/Exception.hpp +++ b/src/Exception.hpp @@ -32,7 +32,9 @@ namespace ArbUt { { } - const char* what() const _GLIBCXX_TXN_SAFE_DYN _GLIBCXX_NOTHROW override { return logic_error::what(); } + [[nodiscard]] const char* what() const _GLIBCXX_TXN_SAFE_DYN _GLIBCXX_NOTHROW override { + return logic_error::what(); + } [[nodiscard]] std::string GetStacktrace([[maybe_unused]] size_t depth = 6, [[maybe_unused]] bool include_addr = true) const { @@ -102,6 +104,12 @@ namespace ArbUt { } auto snippet = snippetFactory.get_snippet(source.filename, source.line, 1)[0].second; + size_t p = snippet.find_first_not_of(" \t"); + snippet.erase(0, p); + + p = snippet.find_last_not_of(" \t"); + if (std::string::npos != p) + snippet.erase(p+1); if (snippet.length() > 70) { snippet = snippet.substr(0, 67); snippet += "...";