Function amqp_error_string

Synopsis

#include <librabbitmq/amqp.h>

char * amqp_error_string(int err)

Description

Get the error string for the given error code.

Deprecated
This function has been deprecated in favor of amqp_error_string2() which returns statically allocated string which do not need to be freed by the caller.

The returned string resides on the heap; the caller is responsible for freeing it.

Parameters:

[ in ] err - return error code

Return
the error string
Since
v0.1

Source

Lines 163-175 in librabbitmq/amqp_api.c. Line 2067 in librabbitmq/amqp.h.

char *amqp_error_string(int code) {
  /* Previously sometimes clients had to flip the sign on a return value from a
   * function to get the correct error code. Now, all error codes are negative.
   * To keep people's legacy code running correctly, we map all error codes to
   * negative values.
   *
   * This is only done with this deprecated function.
   */
  if (code > 0) {
    code = -code;
  }
  return strdup(amqp_error_string2(code));
}





Add Discussion as Guest

Log in to DocsForge