> 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/3d-secure/integrate-d1-sdk/troubleshooting/d1-sdk-error-management.md).

# D1 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.payments.thalescloud.io/3d-secure/integrate-d1-sdk/troubleshooting/d1-sdk-error-management.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
