Function ziAPIGetLastError#

ZIResult_enum ziAPIGetLastError(ZIConnection conn, char *buffer, uint32_t bufferSize)#

Returns the message from the last error that occurred.

This function can be used to obtain the error message from the last error that occurred associated with the provided ZIConnection. If the last ziAPI call is successful, then the last error message returned by ziAPIGetError is empty. Only ziAPI function calls that take ZIConnection as an input argument influence the message returned by ziAPIGetLastError, if they do not take ZIConnection as an input argument the last error message will neither be reset to be empty or set to an error message (in the case of the error). There are some exceptions to this rule, ziAPIGetLastError can also not be used with ziAPIInit, ziAPIConnect, ziAPIConnectEx and ziAPIDestroy

. Note, a call to ziAPIGetLastError will also reset the last error message to empty if its call was successful. Since the buffer is left unchanged in the case of an error occurring in the call to ziAPIGetLastError it is safest to initialize the buffer with a known value, for example, “ziAPIGetLastError was

not successful”.

Parameters:
  • conn[in] The ZIConnection from which to get the error message.

  • buffer[out] A pointer to a char array to return the message.

  • bufferSize[in] The length of the provided buffer.

Returns:

  • ZI_INFO_SUCCESS Upon success.

  • ZI_ERROR_CONNECTION When the connection is invalid (not connected) or when a communication error occurred. In this case the provided buffer is left unchanged.

  • ZI_ERROR_LENGTH If the message’s length exceeds the provided bufferSize, the message is truncated and written to buffer.