#include "tensorstore/util/status.h"
TENSORSTORE_RETURN_IF_ERROR(...);

Causes the containing function to return the specified absl::Status value if it is an error status.

Example:

absl::Status GetSomeStatus();

absl::Status Bar() {
  TENSORSTORE_RETURN_IF_ERROR(GetSomeStatus());
  // More code
  return absl::OkStatus();
}

An optional second argument specifies the return expression in the case of an error. A variable _ is bound to the value of the first expression is in scope within this expression. For example:

TENSORSTORE_RETURN_IF_ERROR(GetSomeStatus(),
                            MaybeAnnotateStatus(_, "In Bar"));

TENSORSTORE_RETURN_IF_ERROR(GetSomeStatus(),
                            MakeReadyFuture(_));

Warning

The absl::Status expression must not contain any commas outside parentheses (such as in a template argument list); if necessary, to ensure this, it may be wrapped in additional parentheses as needed.