# Troubleshooting

Diagnose a Slim Pack failure from the numeric code the function returned — the library has no log file to inspect.

This guide applies to **Slim Pack**.

## Diagnosing a failure

Every TPVPC function returns a numeric code before any XML response, and the same number means different things depending on the function you called. That code is the primary diagnostic.

* [Result Codes and Errors](/en/get-central/slim-pack-reference/result-codes-and-errors) — the return codes per function, and the financial response codes.
* [Request Parameters](/en/get-central/slim-pack-reference/request-parameters) — the full list of functions and their input objects.

## Recovering from a `-2`

`fnDllOperPinPad` and `fnDllOperComContable` can return `-2` on a payment, pre-authorization, confirmation, or refund — most often from an interrupted internet connection, or, for a PIN pad-driven payment or pre-authorization, a device failure. When this happens, the operation's outcome is unknown. Do not resend it blindly.

Query the original operation instead, using a window of ten minutes before and after its timestamp:

```csharp
int result = fnDllOperConsulta(
    null,                   // cNumPedido
    null,                   // cRTS
    "FAC123456789",         // cFactura — the original cFactura
    "20080109 100525",      // cFechaIni — 10 minutes before the operation
    "20080109 102525",      // cFechaFin — 10 minutes after the operation
    "PAGO",                 // cTipo
    null,                   // cResultado
    "0",                    // cNumPagina
    cXMLResp,
    1024
);
```

If `result` is `0`, parse `cXMLResp` for the operation matching your `cFactura` and check its `<estado>` and `<resultado>`: authorized means you can print the receipt, denied means you can resend the operation.

If `result` is also `-2`, check the internet connection. If the problem persists, contact the acquirer to report the incident.

## Next steps

* [Process a Single-Step Payment](/en/get-central/slim-pack-payment-guides/process-a-single-step-payment) — run a standard card-present sale.