Skip to content

Commit

Permalink
Cabin: fix incorrect colorizeAnyhowError (#1137)
Browse files Browse the repository at this point in the history
  • Loading branch information
ken-matsui authored Jan 31, 2025
1 parent fe4a3e1 commit 9c0318b
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/Cabin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,11 @@ getCli() noexcept {

static std::string
colorizeAnyhowError(std::string s) {
if (!shouldColorStderr()) {
return s;
}

if (s.find("Caused by:") != std::string::npos) {
replaceAll(s, "Caused by:", Yellow("Caused by:").toErrStr());
// `Caused by:` leaves a trailing newline, FIXME: upstream this
replaceAll(s, "\n", "");
}
if (s.back() == '\n') {
s.pop_back(); // remove the last '\n' since logger::error adds one.
}
return s;
}
Expand Down

0 comments on commit 9c0318b

Please sign in to comment.