Exception thrown when accessing the value of an invalid StatusOr.
Synopsis
Declared in <absl/status/statusor.h>
class BadStatusOrAccess
: public std::exception
Description
This class defines the type of object to throw (if exceptions are enabled), when accessing the value of an absl::StatusOr<T> object that does not contain a value. This behavior is analogous to that of std::bad_optional_access in the case of accessing an invalid std::optional value.
Example:
try { absl::StatusOr<int> v = FetchInt(); DoWork(v.value()); // Accessing value() when not "OK" may throw } catch (absl::BadStatusOrAccess& ex) { LOG(ERROR) << ex.status(); }
Base Classes
Name |
Description |
|
Base class for all library exceptions. |
Member Functions
Name |
Description |
|
Constructors |
|
Destroys the exception object. |
Assignment operators |
|
Returns the associated error status. |
|
|
Returns the associated explanatory string. |
Created with MrDocs