Public Member Functions | Static Public Attributes | Private Attributes | List of all members
grpc::Status Class Reference

#include <status.h>

Inheritance diagram for grpc::Status:
Inheritance graph
[legend]

Public Member Functions

StatusCode error_code () const
 Return the instance's error code. More...
 
std::string error_details () const
 Return the (binary) error details. More...
 
std::string error_message () const
 Return the instance's error message. More...
 
void IgnoreError () const
 
bool ok () const
 Is the status OK? More...
 
 Status ()
 Construct an OK instance. More...
 
 Status (StatusCode code, const std::string &error_message)
 
 Status (StatusCode code, const std::string &error_message, const std::string &error_details)
 

Static Public Attributes

static const StatusCANCELLED = Status(StatusCode::CANCELLED, "")
 A CANCELLED pre-defined instance. More...
 
static const StatusOK = Status()
 An OK pre-defined instance. More...
 

Private Attributes

std::string binary_error_details_
 
StatusCode code_
 
std::string error_message_
 

Detailed Description

Did it work? If it didn't, why?

See grpc::StatusCode for details on the available code and their meaning.

Describes the status of an RPC.

This is an EXPERIMENTAL API.

Attributes:
  code: A StatusCode object to be sent to the client.
  details: A UTF-8-encodable string to be sent to the client upon
    termination of the RPC.
  trailing_metadata: The trailing :term:`metadata` in the RPC.

Definition at line 35 of file include/grpcpp/impl/codegen/status.h.

Constructor & Destructor Documentation

◆ Status() [1/3]

grpc::Status::Status ( )
inline

Construct an OK instance.

Definition at line 38 of file include/grpcpp/impl/codegen/status.h.

◆ Status() [2/3]

grpc::Status::Status ( StatusCode  code,
const std::string &  error_message 
)
inline

Construct an instance with associated code and error_message. It is an error to construct an OK status with non-empty error_message. Note that message is intentionally accepted as a const reference instead of a value (which results in a copy instead of a move) to allow for easy transition to absl::Status in the future which accepts an absl::string_view as a parameter.

Definition at line 99 of file include/grpcpp/impl/codegen/status.h.

◆ Status() [3/3]

grpc::Status::Status ( StatusCode  code,
const std::string &  error_message,
const std::string &  error_details 
)
inline

Construct an instance with code, error_message and error_details. It is an error to construct an OK status with non-empty error_message and/or error_details.

Definition at line 105 of file include/grpcpp/impl/codegen/status.h.

Member Function Documentation

◆ error_code()

StatusCode grpc::Status::error_code ( ) const
inline

Return the instance's error code.

Definition at line 118 of file include/grpcpp/impl/codegen/status.h.

◆ error_details()

std::string grpc::Status::error_details ( ) const
inline

Return the (binary) error details.

Definition at line 123 of file include/grpcpp/impl/codegen/status.h.

◆ error_message()

std::string grpc::Status::error_message ( ) const
inline

Return the instance's error message.

Definition at line 120 of file include/grpcpp/impl/codegen/status.h.

◆ IgnoreError()

void grpc::Status::IgnoreError ( ) const
inline

Definition at line 131 of file include/grpcpp/impl/codegen/status.h.

◆ ok()

bool grpc::Status::ok ( ) const
inline

Is the status OK?

Definition at line 126 of file include/grpcpp/impl/codegen/status.h.

Member Data Documentation

◆ binary_error_details_

std::string grpc::Status::binary_error_details_
private

Definition at line 136 of file include/grpcpp/impl/codegen/status.h.

◆ CANCELLED

const Status & grpc::Status::CANCELLED = Status(StatusCode::CANCELLED, "")
static

A CANCELLED pre-defined instance.

Definition at line 115 of file include/grpcpp/impl/codegen/status.h.

◆ code_

StatusCode grpc::Status::code_
private

Definition at line 134 of file include/grpcpp/impl/codegen/status.h.

◆ error_message_

std::string grpc::Status::error_message_
private

Definition at line 135 of file include/grpcpp/impl/codegen/status.h.

◆ OK

const Status & grpc::Status::OK = Status()
static

An OK pre-defined instance.

Definition at line 113 of file include/grpcpp/impl/codegen/status.h.


The documentation for this class was generated from the following files:


grpc
Author(s):
autogenerated on Fri May 16 2025 03:03:31