class BadStatusOrAccess

Defined at line 78 of file ../../third_party/abseil-cpp/absl/status/statusor.h

BadStatusOrAccess

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();

}

Public Methods

void BadStatusOrAccess (absl::Status status)
void BadStatusOrAccess (const BadStatusOrAccess & other)
BadStatusOrAccess & operator= (const BadStatusOrAccess & other)
void BadStatusOrAccess (BadStatusOrAccess && other)
BadStatusOrAccess & operator= (BadStatusOrAccess && other)
absl::Nonnull<const char *> what ()

BadStatusOrAccess::what()

Returns the associated explanatory string of the `absl::StatusOr

<T

>`

object's error code. This function contains information about the failing

status, but its exact formatting may change and should not be depended on.

The pointer of this string is guaranteed to be valid until any non-const

function is invoked on the exception object.

const absl::Status & status ()

BadStatusOrAccess::status()

Returns the associated `absl::Status` of the `absl::StatusOr

<T

>` object's

error.

void ~BadStatusOrAccess ()

Defined at line 81 of file ../../third_party/abseil-cpp/absl/status/statusor.h