Skip to content

Commit

Permalink
Merge pull request NixOS#8098 from hercules-ci/error-cc-Only-suggest-…
Browse files Browse the repository at this point in the history
…show-trace-when-truncated-trace-items-would-be-pri

error.cc: Only suggest `--show-trace` when relevant
  • Loading branch information
thufschmitt authored Mar 24, 2023
2 parents eed43de + 233c4cf commit a4c2cd3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/libutil/error.cc
Original file line number Diff line number Diff line change
Expand Up @@ -302,14 +302,14 @@ std::ostream & showErrorInfo(std::ostream & out, const ErrorInfo & einfo, bool s
if (!einfo.traces.empty()) {
size_t count = 0;
for (const auto & trace : einfo.traces) {
if (trace.hint.str().empty()) continue;
if (frameOnly && !trace.frame) continue;

if (!showTrace && count > 3) {
oss << "\n" << ANSI_WARNING "(stack trace truncated; use '--show-trace' to show the full trace)" ANSI_NORMAL << "\n";
break;
}

if (trace.hint.str().empty()) continue;
if (frameOnly && !trace.frame) continue;

count++;
frameOnly = trace.frame;

Expand Down

0 comments on commit a4c2cd3

Please sign in to comment.