Prefix_error_message
ViStatus Prefix_error_message (ViSession vi, ViStatus errCode, ViChar errMessage[]);
Purpose
Translates the error return value from an instrument driver function to a user-readable string.
Parameter
Input | ||
Name | Type | Description |
---|---|---|
vi | ViSession | Unique identifier for an IVI session. Can be VI_NULL |
errCode | ViStatus | Instrument driver error code |
Output | ||
Name | Type | Description |
errMessage | ViChar array | Instrument driver error message |
Return Values
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
Implementation Requirements
Your Prefix_error_message function must accept a value of VI_NULL for the vi input parameter. This allows the user to call the function even when Prefix_init or Prefix_InitWithOptions fails. On the other hand, report an error if the user passes VI_NULL for the address of the errMessage output buffer.
If your driver defines its own error codes, define a static string/value table containing the error codes and message strings. Use the IviStringValueTable typedef in ivi.h. Terminate the table with an entry that has VI_NULL in both fields.
If the vi parameter is not VI_NULL, call Ivi_LockSession to lock the IVI session.
Call the Ivi_GetSpecificDriverStatusDesc function. Pass the address of your error string/value table as the last parameter. If your driver does not have its own error codes, pass VI_NULL for the last parameter.
If the vi parameter is not VI_NULL, call Ivi_UnlockSession to unlock the IVI session.