# Wallet Error Response

When an error occurs while processing a request on **The Bet Brothers Platform**, the **Operator** should respond with the **appropriate HTTP status code** and a JSON body containing a `code` and a `message` to provide more context about the error.

```json
{
  "code": 402,
  "message": "The player does not have enough money for the action."
}
```

In this example:

* The **HTTP Status Code** indicates the error type.
* The **code** in the response provides further specifics about the error (in this case, `402` for insufficient funds).
* The **message** provides a human-readable explanation.

### **Error Codes and Messages**

Here are the common error codes with their corresponding HTTP status codes and messages:

| **HTTP Code** | **Error Code** | **Message**                                           |
| ------------- | -------------- | ----------------------------------------------------- |
| **400**       | `400`          | Bad request. Badly formatted JSON.                    |
| **402**       | `402`          | The player does not have enough money for the action. |
| **403**       | `403`          | Forbidden. Request sign doesn't match.                |
| **404**       | `404`          | Player not found.                                     |
| **405**       | `405`          | Game is not available.                                |
| **406**       | `406`          | Previous transaction not found.                       |
| **407**       | `407`          | Player is blocked.                                    |
| **408**       | `408`          | Bet is rejected.                                      |
| **418**       | `418`          | The player has reached his responsible limits.        |
| **500**       | `500`          | Unknown error.                                        |
| **503**       | `503`          | Service is unavailable.                               |
| **504**       | `504`          | Request timed out.                                    |

#### **Error Response Format**

The error response should always follow this structure:

```json
{
  "code": <error_code>,
  "message": "<error_message>"
}

```

Where:

* **code**: The error code is a numeric value that identifies the type of error.
* **message**: A human-readable explanation of the error.
