niRFSA_GetError

NI RF Vector Signal Analyzers

niRFSA_GetError

ViStatus = niRFSA_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 errorDescriptionBufferSize parameter is 0, this function does not clear the error information. By passing 0 for the buffer size, you can determine the buffer size required to get the entire error description string and 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 then clears the error information for the session. If you pass VI_NULL for vi, this function retrieves and then clears the error information for the current execution thread. If vi 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 niRFSA_ClearError.

Parameters

Input
Name Type Description
vi ViSession Identifies your instrument session. vi is obtained from the niRFSA_init or the niRFSA_initWithOptions functions and identifies a particular instrument session.
errorDescriptionBufferSize 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 buffer size - 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 errorDescription 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 errorDescriptionBufferSize parameter, you can pass VI_NULL for this parameter.
errorDescription ViChar Returns the error description for the IVI session or execution thread.

If there is no description, this function returns an empty string. The buffer must contain at least as many elements as the value you specify with the buffer size parameter. If the error description, including the terminating NULL byte, contains more bytes than you indicate with the buffer size parameter, the function copies buffer size - 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 for the buffer size, 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. You 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 niRFSA_error_message function. To obtain additional information about the error condition, call the niRFSA_GetError function. To clear the error information from the driver, call the niRFSA_ClearError function.

The general meaning of the status code is as follows:

Value
Meaning
0 Success
Positive Values Warnings
Negative Values Errors