public static PcanStatus GetErrorText(
PcanStatus errorCode,
out string errorText,
OutputLanguage language
)
Public Shared Function GetErrorText (
errorCode As PcanStatus,
<OutAttribute> ByRef errorText As String,
language As OutputLanguage
) As PcanStatus
public:
static PcanStatus GetErrorText(
PcanStatus errorCode,
[OutAttribute] String^% errorText,
OutputLanguage language
)
Contains the description text of the given errorCode.
The content of errorText is only valid if the returned value of this method is OK.
OK is returned on success. The typical errors in case of failure are:
The "Primary language IDs" are codes used by Windows OS from Microsoft, to identify a human language. Currently, following languages are supported:
Language | Primary Language ID |
---|---|
Neutral (System dependent) | 00h (0) |
English | 09h (9) |
German | 07h (7) |
French | 0Ch (12) |
Italian | 10h (16) |
Spanish | 0Ah (10) |
The following example shows the use of the GetErrorText(PcanStatus, String) method. The description of all available error codes are requested using Spanish as output language.
In case of failure, the returned code will be translated to a text (according with the operating system language) in English, German, Italian, French or Spanish, and it will be shown to the user.
PcanStatus result;
string errorText = String.Empty;
foreach (PcanStatus errorCode in Enum.GetValues(typeof(PcanStatus)))
{
result = Api.GetErrorText(errorCode, out errorText, OutputLanguage.Spanish);
if (result != PcanStatus.OK)
{
// An error occurred
//
Console.WriteLine($" [{((uint)errorCode):X8}] {errorCode}: Error while retrieving --> {result}");
}
else
{
Console.WriteLine($" [{((uint)errorCode):X8}] {errorCode}: {errorText}");
}
}
Dim result As PcanStatus
Dim errorText As String = String.Empty
For Each errorCode As PcanStatus In [Enum].GetValues(GetType(PcanStatus))
result = Api.GetErrorText(errorCode, errorText, OutputLanguage.Spanish)
If result <> PcanStatus.OK Then
' An error occurred
'
Console.WriteLine($" [{CUInt(errorCode):X8}] {errorCode}: Error while retrieving --> {result}")
Else
Console.WriteLine($" [{CUInt(errorCode):X8}] {errorCode}: {errorText}")
End If
Next
PcanStatus result;
String^ errorText = String::Empty;
for each(PcanStatus errorCode in Enum::GetValues(PcanStatus::typeid))
{
result = Api::GetErrorText(errorCode, errorText, OutputLanguage::Spanish);
if (result != PcanStatus::OK)
{
// An error occurred
//
Console::WriteLine(" [{0:X8}] {1}: Error while retrieving --> {2}", (UInt32)errorCode, errorCode, result);
}
else
{
Console::WriteLine(" [{0:X8}] {1}: {2}", (UInt32)errorCode, errorCode, errorText);
}
}
DllNotFoundException | The underlying PCANBasic.dll library could not be found. |
PcanBasicException | The execution of a PCAN-Basic related check operation ended with an unexpected result. Typically, this exception is triggered when a device driver is not installed or is not up to date. |