> 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/nfc-wallet-sdk-android/help/error-management/mg-error-management.md).

# MG error management

## Overview

This section covers the errors that can be returned from the MG module. For example when using the service `MGCardEnrollmentService`.

## MobileGatewayError

In the MG module, all the errors are managed through the `MobileGatewayError` object.

The structure of the `MobileGatewayError` object is as follows:

* SDK Error code: Provides the type of error that occurred.
* Server Error code: The numerical code of the error to indicate the error caused on the server side.
* HTTP Error code: The HTTP status code caused by communication errors.
* Message: A description of the error.

The errors are to be parsed in the following way:

1. `getSDKErrorCode()`- to retrieve the type of error.
2. If the type is :
   * `SERVER_ERROR`, use `getServerErrorCode()` to get the exact error that happened on MG server.
   * `HTTP_ERROR`, use `getHTTPStatusCode()` to get the HTTP status code caused by the communication error.
3. Use `getMessage()` to retrieve a descriptive text of the error.

{% hint style="info" %}
For more details about MobileGatewayError, refer to [Android API](/nfc-wallet-sdk-android/android-api.md)
{% endhint %}

## MGErrorCode

`MGErrorCode` is the `enum` that provides all the error codes returned by the MG module to MPA during usage of public API of the MG module. This is part of public API of the MG module and please refer to Javadoc for details on each error code.

```java
package com.gemalto.mfs.mwsdk.mobilegateway.enrollment;
public enum MGErrorCode {
    NO_INTERNET,
    CONNECTION_TIMEOUT,
    COMMUNICATION_ERROR,
    SERVER_ERROR,
    INTERNAL_ERROR,
    FPAN_NOT_ELIGIBLE,
    UNKNOWN_BIN,
    UNKNOWN_CARD_PRODUCT,
    CARD_PRODUCT_NOT_SUPPORTED,
    INCORRECT_CVV,
    CARD_ALREADY_PROVISIONED_IN_WALLET,
    DEVICE_NOT_ELIGIBLE,
    RESOURCE_NOT_FOUND,
    INCORRECT_AUTHENTICATION_TOKEN,
    CARD_PROVISIONING_COUNT_EXCEEDED,
    UNKONOWN_IDV_METHOD,
    PROVISIONING_NOT_ALLOWED,
    INCORRECT_OTP,
    INCORRECT_OTP_MAX_TRY_EXCEEDED,
    OTP_EXPIRED,
    IDV_METHOD_NOT_AVAILABLE,
    UNEXPECTED_INTERNAL_ERROR,
    EXTERNAL_SYSTEM_UNAVAILABLE,
    UNKNOWN_WALLET_PROVIDER_ID,
    UNKNOWN_WALLET_ID,
    UNKNOWN_DIGITAL_CARD_ID,
    UNKNOWN_CORRELATION_ID,
    CARD_STATE_DOES_NOT_ALLOW_REQUESTED_OPERATION,
    OPERATION_ALREADY_ONGOING,
    OPERATION_FAILED,
    UNKNOWN_DEVICE_ID,
    MISSING_REQUIRED_PARAMETER,
    UNKNOWN_ISSUER_ID,
    UNKNOWN_CARD_ID,
    NO_TNC_RESOURCE_ID,
    INVALID_TNC_DATA_TYPE,
    SECURESTORAGE_WRITE_CONFIG_DATA_ERROR,
    SECURESTORAGE_WIPE_ALL_ERROR,
    CONTEXT_MISSING_ERROR,
    WEB_3DS_AUTHENTICATION_FAILED,
    WEB_3DS_DATA_ERROR,
    INVALID_CARD_DATA,
    NO_CARD_META_DATA,
    CARD_META_DATA_JSON_ERROR,
    NO_CARD_DATA,
    DEVICE_SUSPICIOUS,
    SDK_DATA_VERSION_NOT_SUPPORTED
}
```


---

# 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, and the optional `goal` query parameter:

```
GET https://docs.payments.thalescloud.io/nfc-wallet-sdk-android/help/error-management/mg-error-management.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
