> ## Documentation Index
> Fetch the complete documentation index at: https://notevil.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# CAPLfunctionDiagGetErrorString

# diagGetErrorString

[Valid for](../../../Shared/FeatureAvailability.md): CANoe DE

## Function Syntax

```
long diagGetErrorString (long errorCode, char bufferOut[], dword bufferLength)
```

## Description

Retrieves a text describing the error code.

## Parameters

* **errorCode**: Numeric error code
* **bufferOut**: Output buffer
* **bufferLength**: Output buffer size

## Return Values

Length of the text in **bufferOut**.

## Example

```plaintext theme={null}
on key 't'
{
  long retValue;
  char buffer[200];
  if (0 > (retValue=diagSetTarget("UDS_Diagnostic_Services"))) 
  {
    diagGetErrorString(retValue, buffer, elcount(buffer));
    write("Error: %s", buffer);
  }
}
```
