# Errors

The error object explains the error details of your request. It is encapsulated as an 'error' object in the response, if no error is found then you should expect the error object to be omitted from the response.

### Error Object

```jsonp
{
    "code": "400100xxx",
    "message": "human-readable message response",
    "error": {      
        "type": "API_ERROR",      
        "details": [
            {
                "field": "Email",
                "message": "Email is required"
            }
        ],      
        "trace_id": "ed9ef145530fc386190ddd7612ed61c7"
    },
    "data": { 
        // resource object
    }
```

The error object contains the following information:

#### Type

Error Type, values will be one of API\_ERROR, GATEWAY\_ERROR, PARTNER\_ERROR

* API\_ERROR: Either error is caused by validation error or invalid request. Usually will have http status 4xx
* GATEWAY\_ERROR: Error is on Harsya Gateway side. You should expect this to rarely happen. Usually will have http status 5xx
* PARTNER\_ERROR: Interaction with one of our Payment channels is causing an error, error reasons are various. Usually will be accompanied by http status 5xx

#### Detail

Error details are exclusive for validation error. You may expect it will contain an array of invalid fields.

#### Trace ID

ID to trace your request, if a request is not accompanied by `traceId`, then Harsya's system will generate the trace id for you. You can use the `traceId` when raising a helpdesk ticket to Harsya
