Modern C++ Kafka API
Public Member Functions | List of all members
KAFKA_API::Error Class Reference

Unified error type. More...

#include <Error.h>

Public Member Functions

 Error (rd_kafka_error_t *error=nullptr)
 
 Error (rd_kafka_resp_err_t respErr)
 
 Error (rd_kafka_resp_err_t respErr, std::string message, bool fatal=false)
 
 Error (const Error &error)
 
Erroroperator= (const Error &error)
 
 operator bool () const
 Check if the error is valid.
 
 operator std::error_code () const
 Conversion to std::error_code
 
int value () const
 Obtains the underlying error code value. More...
 
std::string message () const
 Readable error string.
 
std::string toString () const
 Detailed error string.
 
bool isFatal () const
 Fatal error indicates that the client instance is no longer usable.
 
Optional< bool > isRetriable () const
 Show whether the operation may be retried.
 
bool transactionRequiresAbort () const
 Show whether the error is an abortable transaction error. More...
 

Detailed Description

Unified error type.

Member Function Documentation

◆ transactionRequiresAbort()

bool KAFKA_API::Error::transactionRequiresAbort ( ) const
inline

Show whether the error is an abortable transaction error.

Note:

  1. Only valid for transactional API.
  2. If true, the producer must call abortTransaction and start a new transaction with beginTransaction to proceed with transactions.

◆ value()

int KAFKA_API::Error::value ( ) const
inline

Obtains the underlying error code value.

Actually, it's the same as 'rd_kafka_resp_err_t', which is defined by librdkafka.

  1. The negative values are for internal errors.
  2. Non-negative values are for external errors. See the defination at,

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