ClearErrorInfo

IVI Library

Ivi_ClearErrorInfo

Usage

ViStatus Ivi_ClearErrorInfo(ViSession vi);

Purpose

This function clears the error information for the current execution thread and the IVI session you specify. If you pass VI_NULL for the vi parameter, this function clears the error information only for the current execution thread.

Instrument drivers export this function to the end-user through the PREFIX_ClearError function. Normally, the error information describes the first error that occurred since the end-user last called PREFIX_GetErrorInfo or PREFIX_ClearError.

The error information includes a primary error code, secondary code error, and an error elaboration string. For a particular session, this information is the same as the values held in the following attributes:

IVI_ATTR_PRIMARY_ERROR or PREFIX_ATTR_PRIMARY_ERROR
IVI_ATTR_SECONDARY_ERROR or PREFIX_ATTR_SECONDARY_ERROR
IVI_ATTR_ERROR_ELABORATION or PREFIX_ATTR_ERROR_ELABORATION

The IVI engine also maintains this error information separately for each thread. This is useful if you do not have a session handle to pass to Ivi_SetErrorInfo or Ivi_GetErrorInfo, which occurs when a call to Ivi_SpecificDriverNew fails.

This function sets the primary and secondary error codes to VI_SUCCESS (0), and sets the error elaboration string to ".

Avoid calling this function except to implement the PREFIX_ClearError function. Normally, it is the responsibility of the end-user to decide when to clear the error information. Ivi_GetErrorInfo, which the end-user calls through PREFIX_GetErrorInfo, always clears the error information.

Parameters

Name Type Description
vi ViSession

To clear the error information for a particular IVI session, pass the ViSession handle that you obtain from Ivi_SpecificDriverNew. When you pass a ViSession handle, the function also clears the error information for the current thread.

To clear only the error information for the current thread, pass VI_NULL.

Return Value

Contains the status code that the function call returns. IVI engine functions can return error and warning values from several sets of status codes. Some status codes are unique to the IVI engine. Other status codes are the same codes that VISA Library functions return. Still others are error or warning values that functions in specific instrument drivers return. Each set of status codes has its own numeric range.

Regardless of the source of the status code, 0 always indicates success, a positive value indicates a warning, and a negative value indicates an error.

Related Topic

IVI Status Codes