> For the complete documentation index, see [llms.txt](https://docs.payments.thalescloud.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.payments.thalescloud.io/secure-card-display/integrate-d1-sdk/troubleshooting/sdk-error-management.md).

# SDK error management

When D1 SDK API is not able to succeed, it returns an error in its callback. In the API documentation, each API lists its possible errors.

`D1Exception.getMessage()` (Android) and `D1Error.errorDescription` (iOS) provide a String representation of the error information. It is recommended for the issuer application to include the error stack trace in their support tickets as in the following code snippets:

{% tabs %}
{% tab title="Android" %}
{% code title="Example: read the error message (Android)" %}

```java
D1Exception d1Exception; // thrown by SDK API
String message = d1Exception.getMessage();
```

{% endcode %}
{% endtab %}

{% tab title="iOS" %}
{% code title="Example: read the error message (iOS)" %}

```swift
if let d1Error = error { // thrown by SDK API
    var message = d1Error.errorDescription
}
```

{% endcode %}
{% endtab %}
{% endtabs %}

### Truncated error content

If you have a size constraint on the error information and needs a truncation, use the following APIs to obtain a brief version of the error:

{% tabs %}
{% tab title="Android" %}
`D1Exception.getErrorCode()` returns `D1Exception.ErrorCode` that describes the error type.
{% endtab %}

{% tab title="iOS" %}
`D1Error.code` returns `D1Error.Code` that describes the error type.
{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.payments.thalescloud.io/secure-card-display/integrate-d1-sdk/troubleshooting/sdk-error-management.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
