niRFSG_GetError

NI-RFSG C Function

niRFSG_GetError

C Function Prototype

ViStatus niRFSG_GetError (ViSession vi, ViStatus* errorCode, ViInt32 errorDescriptionBufferSize, ViChar errorDescription[]);

Purpose

Retrieves and then clears the IVI error information for the session or the current execution thread.

 Note  If the bufferSize parameter is 0, this function does not clear the error information. By passing 0 to the bufferSize parameter, you can determine the buffer size required to get the entire error description string. You can then call this function again with a sufficiently large buffer. If you specify a valid IVI session for the vi parameter, this function retrieves and clears the error information for the session. If you pass VI_NULL for the vi parameter, this function retrieves and clears the error information for the current execution thread. If the vi parameter is an invalid session, this function does nothing and returns an error. Normally, the error information describes the first error that occurred since the user last called this function or the niRFSG_ClearError function.

Parameters

Input
Name Type Description
vi ViSession Identifies your instrument session. The ViSession handle is obtained from the niRFSG_init function or the niRFSG_InitWithOptions function and identifies a particular instrument session.

Default Value: None

buffersize ViInt32 Pass the number of bytes in the ViChar array you specify for the description parameter.

If the error description, including the terminating NULL byte, contains more bytes than you indicate in this parameter, the function copies bufferSize - 1 bytes into the buffer, places an ASCII NULL byte at the end of the buffer, and returns the buffer size you must pass to get the entire value. For example, if the value is 123456 and the buffer size is 4, the function places 123 into the buffer and returns 7. If you pass a negative number, the function copies the value to the buffer regardless of the number of bytes in the value. If you pass 0, you can pass VI_NULL for the description parameter.

Default Value: None

Output
Name Type Description
errorCode ViStatus* Returns the error code for the session or execution thread. If you pass 0 for the BufferSize parameter, you can pass VI_NULL for this parameter.
description ViChar[] Returns the error description for the IVI session or execution thread.

If there is no description, the function returns an empty string. The buffer must contain at least as many elements as the value you specify with the bufferSize parameter. If the error description, including the terminating NULL byte, contains more bytes than you indicate with the bufferSize parameter, the function copies bufferSize - 1 bytes into the buffer, places an ASCII NULL byte at the end of the buffer, and returns the buffer size you must pass to get the entire value. For example, if the value is 123456 and the buffer size is 4, the function places 123 into the buffer and returns 7. If you pass 0, you can pass VI_NULL for this parameter.

Return Value

Name Type Description
status ViStatus Returns the status code of this operation. The status code either indicates success or describes an error or warning condition. Examine the status code from each call to an instrument driver function to determine if an error occurred.

To obtain a text description of the status code, call the niRFSG_error_message function. To obtain additional information about the error condition, call the niRFSG_GetError function. To clear the error information from the driver, call the niRFSG_ClearError function.

The general meaning of the status code is as follows:

ValueMeaning
0Success
Positive ValuesWarnings
Negative ValuesErrors