Skip to content

Commit 4a82a5d

Browse files
committed
Add an ostream formatter for StackTraceError
Bug: b/471297333
1 parent e93bca8 commit 4a82a5d

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

base/cvd/cuttlefish/result/error_type.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include "cuttlefish/result/error_type.h"
1717

1818
#include <optional>
19+
#include <ostream>
1920
#include <sstream>
2021
#include <string>
2122
#include <utility>
@@ -210,6 +211,10 @@ std::string ResultErrorFormat(bool color) {
210211
return "{:" + fmt_str + "}";
211212
}
212213

214+
std::ostream& operator<<(std::ostream& out, const StackTraceError& error) {
215+
return out << error.FormatForEnv();
216+
}
217+
213218
} // namespace cuttlefish
214219

215220
fmt::format_context::iterator

base/cvd/cuttlefish/result/error_type.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,8 @@ inline StackTraceEntry::operator android::base::expected<T,
211211
return android::base::unexpected(std::move(*this));
212212
}
213213

214+
std::ostream& operator<<(std::ostream&, const StackTraceError&);
215+
214216
} // namespace cuttlefish
215217

216218
/**

0 commit comments

Comments
 (0)