proposal/L88-cpp-absl-status-convers...

1.3 KiB

Provide conversions from grpc::Status to absl::Status and back again

Abstract

Add conversion operations between absl::Status and grpc::Status to help boost interoperability with that library, and to aid in modernizing our codebase.

Background

grpc::Status was originally intended to be a polyfill for absl::Status. The released absl::Status however was not directly compatible with grpc::Status. Introduce canonical conversion operations between the two types.

N/A

Proposal

Add to grpc::Status:

  • an explicit conversion from absl::Status
  • implicit const& and && conversion operators to absl::Status

i.e.:

namespace grpc {
class Status {
 public:
  // ...
  explicit Status(absl::Status&&);
  operator const absl::Status&() const;
};
}

Rationale

We'd like to change to absl::Status everywhere, but we can't. Internal users are experiencing pain since these conversions are available there, but not externally.

Implementation

This proposal will be implemented as a single PR (and likely an associated cherry-pick internally).

Open issues (if applicable)

N/A