Google Cloud C++ Client 2.10.1
C++ Client Library for Google Cloud Platform
Loading...
Searching...
No Matches
grpc_error_delegate.h
1// Copyright 2020 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_GRPC_ERROR_DELEGATE_H
16#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_GRPC_ERROR_DELEGATE_H
17
18#include "google/cloud/status.h"
19#include "google/cloud/version.h"
20#include <google/rpc/status.pb.h>
21#include <grpcpp/grpcpp.h>
22#include <string>
23
24namespace google {
25namespace cloud {
27
28/**
29 * Creates a google::cloud::Status from a grpc::Status.
30 */
31google::cloud::Status MakeStatusFromRpcError(grpc::Status const& status);
32
33/**
34 * Creates a google::cloud::Status from a grpc::StatusCode and description.
35 */
36google::cloud::Status MakeStatusFromRpcError(grpc::StatusCode code,
37 std::string what);
38
39/**
40 * Creates a `google::cloud::Status` from a `google:rpc::Status` proto.
41 *
42 * Some gRPC services return the `google::rpc::Status` proto for errors. The
43 * libraries in `google-cloud-cpp` represent these errors using a
44 * `google::cloud::Status`.
45 */
46google::cloud::Status MakeStatusFromRpcError(google::rpc::Status const& proto);
47
49} // namespace cloud
50} // namespace google
51
52#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_GRPC_ERROR_DELEGATE_H
Represents success or an error with info about the error.
Definition: status.h:295
Contains all the Google Cloud C++ Library APIs.
Definition: async_operation.h:23
google::cloud::Status MakeStatusFromRpcError(grpc::Status const &status)
Creates a google::cloud::Status from a grpc::Status.
google::cloud::Status MakeStatusFromRpcError(grpc::StatusCode code, std::string what)
Creates a google::cloud::Status from a grpc::StatusCode and description.
google::cloud::Status MakeStatusFromRpcError(google::rpc::Status const &proto)
Creates a google::cloud::Status from a google:rpc::Status proto.
Definition: async_operation.h:22
#define GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
Definition: version.h:45
#define GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
Definition: version.h:43