3 Commits
Author SHA1 Message Date
Janusz Sobczak 7a99b5e0a3 Specialize ExceptionOr<bool>
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
2023-06-30 11:59:43 -07:00
Suet-Fei Li 084f7ebd88 Remove location namespace in third_party/nearby.
PiperOrigin-RevId: 500023196
2023-01-06 02:53:57 -08:00
hais f5fcd35ced nearby sdk refactor
PiperOrigin-RevId: 425434260
2022-02-02 11:56:39 -08:00