# Error

Error codes, messages, and field validation failures.

[Definition in OpenAPI](https://api.cadmospay.com/static/api/gateway-machine-api.json#/components/schemas/Error)

## JSON schema

```json
{
  "type": "object",
  "properties": {
    "message": {
      "type": "string"
    },
    "code": {
      "type": "string",
      "description": "A stable code where one is named in this file, such as `GATEWAY_REQUEST_CONFLICT`."
    },
    "violations": {
      "type": "array",
      "description": "With `code: VALIDATION_ERROR`: each field (`<unknown>` for a field this contract does not have) and the rule it broke.",
      "items": {
        "type": "object",
        "properties": {
          "field": {
            "type": "string"
          },
          "code": {
            "type": "string"
          }
        },
        "required": [
          "field",
          "code"
        ]
      }
    }
  },
  "examples": [
    {
      "code": "GATEWAY_LINK_NOT_FOUND"
    },
    {
      "message": "Invalid request",
      "code": "VALIDATION_ERROR",
      "violations": [
        {
          "field": "amountUsd",
          "code": "string.pattern.base"
        }
      ]
    }
  ]
}
```
