Trim whitespace of snippets in stack traces.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2020-08-16 19:45:19 +02:00
parent 98ff6b3b69
commit a64c2aaca8
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
1 changed files with 9 additions and 1 deletions

View File

@ -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 += "...";