Skip to content

Commit 39a3b02

Browse files
JacobSzwejbkafacebook-github-bot
authored andcommitted
Log when a Result is created from Error::ok (#8577)
Summary: If this ctor is firing something has probably gone wrong. I found it a little hard to debug so adding logging to hopefully save someone else time in the future. Differential Revision: D69870978
1 parent 00c1443 commit 39a3b02

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

runtime/core/result.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,14 @@ class Result final {
6060
*/
6161
/* implicit */ Result(Error error)
6262
: error_(error == Error::Ok ? Error::Internal : error),
63-
hasValue_(false) {}
63+
hasValue_(false) {
64+
if ET_UNLIKELY(error == Error::Ok) {
65+
ET_LOG(
66+
Info,
67+
"Attempted to create Result from Error::OK, \
68+
this has been converted to Error::Internal.");
69+
}
70+
}
6471

6572
/// Value copy constructor.
6673
/* implicit */ Result(const T& val) : value_(val), hasValue_(true) {}

0 commit comments

Comments
 (0)