librdkafka
The Apache Kafka C/C++ client library
RdKafka::Error Class Referenceabstract

The Error class is used as a return value from APIs to propagate an error. The error consists of an error code which is to be used programatically, an error string for showing to the user, and various error flags that can be used programmatically to decide how to handle the error; e.g., should the operation be retried, was it a fatal error, etc. More...

#include <rdkafkacpp.h>

Public Member Functions

virtual ErrorCode code () const =0
 
virtual std::string name () const =0
 
virtual std::string str () const =0
 
virtual bool is_fatal () const =0
 
virtual bool is_retriable () const =0
 
virtual bool txn_requires_abort () const =0
 

Static Public Member Functions

static Errorcreate (ErrorCode code, const std::string *errstr)
 Create error object.
 

Detailed Description

The Error class is used as a return value from APIs to propagate an error. The error consists of an error code which is to be used programatically, an error string for showing to the user, and various error flags that can be used programmatically to decide how to handle the error; e.g., should the operation be retried, was it a fatal error, etc.

Error objects must be deleted explicitly to free its resources.

Member Function Documentation

◆ code()

virtual ErrorCode RdKafka::Error::code ( ) const
pure virtual
Returns
the error code, e.g., RdKafka::ERR_UNKNOWN_MEMBER_ID.

◆ name()

virtual std::string RdKafka::Error::name ( ) const
pure virtual
Returns
the error code name, e.g, "ERR_UNKNOWN_MEMBER_ID".

◆ str()

virtual std::string RdKafka::Error::str ( ) const
pure virtual
Returns
a human readable error string.

◆ is_fatal()

virtual bool RdKafka::Error::is_fatal ( ) const
pure virtual
Returns
true if the error is a fatal error, indicating that the client instance is no longer usable, else false.

◆ is_retriable()

virtual bool RdKafka::Error::is_retriable ( ) const
pure virtual
Returns
true if the operation may be retried, else false.

◆ txn_requires_abort()

virtual bool RdKafka::Error::txn_requires_abort ( ) const
pure virtual
Returns
true if the error is an abortable transaction error in which case the application must call RdKafka::Producer::abort_transaction() and start a new transaction with RdKafka::Producer::begin_transaction() if it wishes to proceed with transactions. Else returns false.
Remarks
The return value of this method is only valid for errors returned by the transactional API.

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