---
updatedAt: 2026-03-02T12:04:02.000Z
agentTools:
  projectIndex: https://docs.moneyhubenterprise.com/llms.txt
---

# Error Handling

Distinguishing platform vs provider (ASPSP) failures and handling payment and consent errors.

## Platform vs Provider Failures

### Overview

To distinguish between Moneyhub platform errors and downstream bank/provider connectivity failures that result in HTTP 5xx status codes, we've implemented a granular error-handling mechanism.

### Identification

Errors containing **"ASPSP"** in the error description indicate a connectivity or service issue reported by the bank or financial provider, rather than an internal platform issue.

### Error Types

There are two possible downstream provider error scenarios:

1. **Payment Submission Error** - Issues occurring during payment submission
2. **Payment Consent Creation Error** - Issues occurring during consent creation

### Error Response Structure

When a downstream provider error occurs, the response will contain:

#### HTTP Response

```json
{
  "statusCode": 502,
  "statusMessage": "Bad Gateway",
  "code": "ERR_NON_2XX_3XX_RESPONSE",
  "error": "BadGateway",
  "error_description": "ASPSP client error: payment consent creation"
}
```

#### Raw Response Body

```json
{
  "response": {
    "body": {
      "code": "BadGateway",
      "message": "ASPSP client error: payment consent creation"
    }
  }
}
```

### Key Indicators

* **`statusCode: 502`** - Bad Gateway status
* **`error_description` containing `"ASPSP"`** - Confirms downstream provider issue
* **Specific operation mentioned** (e.g., `"payment consent creation"` or `"payment submission"`) - Identifies where the failure occurred

### Examples

#### Payment Consent Creation Error

```json
{
  "error": "BadGateway",
  "error_description": "ASPSP client error: payment consent creation"
}
```

#### Payment Submission Error

```json
{
  "error": "BadGateway",
  "error_description": "ASPSP client error: payment submission"
}
```