Some of the tests are flaky.
Significantly increased timeouts will give us confidence that
tests are failing due to a defect and not due to a test taking a little
bit more time than usual.
PiperOrigin-RevId: 547819011
ExceptionOr<T>::ok() returns true if the value is set. This can be misleading
for boolean types.
ExceptionOr<bool> result = SomeFunction();
if (result.ok()) {
if (result.result() {
// Case 1: SomeFunction returned true
} else {
// Case 2: SomeFunction returned false
} else {
// Case 3: SomeFunction returned an exception
}
It's easy to overlook case 2.
The specialized ExceptionOr<bool>::ok() returns false in Case 2, which allows
us to write:
if (result) {
// SomeFunction returned true
} else {
// SomeFunction returned false or an exception
// result.GetException() can be used if we need to handle different exceptions
// differenty
}
PiperOrigin-RevId: 544715641
Read() can return fewer bytes than requested.
ReadExactly() will call Read() repeatedly until we
have read as many bytes as we need.
PiperOrigin-RevId: 518719418