# Error Messaging

The Flights APIs share common error handling and return the standard error messages listed in this topic.

### Error Handling

The TripServices Flights APIs return consistent error messages for all content, including GDS and NDC. Specific error messages are listed below in [Error Message List](#list).

Errors are returned in Result/Error and warnings in Result/Warning. Errors are returned when request processing is unsuccessful. Warnings are returned to warn about conditions when the request was successful. Both Error and Warning include the following:

- StatusCode
- Message
- SourceID
- SourceCode
- Category


SourceID may return the value *API*, a supplier code, or the value *1G* as the GDS code.

- API: Returned for any business or impairment error in which the source was the API.
- When the error source was not the API, one of the following values may be returned:
  - For GDS content, SourceID returns the value *1G*.
  - For NDC content, SourceID returns the carrier code for the NDC airline.


For SourceCode, the values returned are grouped into the following ranges:

- 1: Impairment errors
- 1000: Common object validation errors: Errors related to object and property validation issues
- 2000: System-wide errors: Can occur for any content and in any workflow. Include communication, authorization, header, or query parameter errors.
- 3000: AirPrice errors
- 4000: AirReservation errors
- 8000: Ancillaries errors
- 9000: Search errors
- 13000: Hotel errors
- 20000: Exchange errors
- 21000: Eligibility errors


This update also standardizes handling for communication errors occurring when a supplier cannot be reached or the information returned is not usable. In that case, the StatusCode is *200*, the Message is *COMMUNICATION ERROR*, and the SourceCode is *2599*.

Although the following examples are from Search responses, Result/Error uses the same format across all TripServices Flights APIs.

details
summary
Show Example error response for GDS
```json
{
"CatalogProductOfferingsResponse": {
"@type": "CatalogProductOfferingsResponse",
"transactionId": "d83eab5b-716d-41f0-9fac-0f75c7ab6d1c",
"traceId": "6cd59832-b000-4de0-908d-b39a1af65284",
"Result": {
"@type": "Result",
"Error": [
    {
    "@type": "ErrorDetail",
    "StatusCode": 200,
    "Message": "COMMUNICATION ERROR",
    "SourceID": "1G",
    "SourceCode": "2599"
    "category": "UNKNOWN"
    }
]
}
}
}
```

details
summary
Show Example error response for NDC
```json
{
"CatalogProductOfferingsResponse": {
"@type": "CatalogProductOfferingsResponse",
"transactionId": "97a6ee4c-db5b-41e0-a10f-f9362044de6c",
"traceId": "6cd59832-b000-4de0-908d-b39a1af65284",
"Result": {
"@type": "Result",
"Error": [
    {
    "@type": "ErrorDetail",
    "StatusCode": 200,
    "Message": "COMMUNICATION ERROR",
    "SourceID": "BA",
    "SourceCode": "2599"
    "category": "UNKNOWN"
    },
    {
    "@type": "ErrorDetail",
    "StatusCode": 200,
    "Message": "COMMUNICATION ERROR",
    "SourceID": "UA",
    "SourceCode": "2599"
    "category": "UNKNOWN"
    },
    {
    "@type": "ErrorDetail",
    "StatusCode": 200,
    "Message": "COMMUNICATION ERROR",
    "SourceID": "AA",
    "SourceCode": "2599"
    "category": "UNKNOWN"
    },
    {
    "@type": "ErrorDetail",
    "StatusCode": 200,
    "Message": "COMMUNICATION ERROR",
    "SourceID": "QF",
    "SourceCode": "2599"
    "category": "UNKNOWN"
    },
    {
    "@type": "ErrorDetail",
    "StatusCode": 200,
    "Message": "COMMUNICATION ERROR",
    "SourceID": "QR",
    "SourceCode": "2599"
    "category": "UNKNOWN"
    }
]
}
}
}
```

details
summary
Show Example error response for combined GDS and NDC content
```json{
"CatalogProductOfferingsResponse": {
"@type": "CatalogProductOfferingsResponse",
"transactionId": "97a6ee4c-db5b-41e0-a10f-f9362044de6c",
"traceId": "6cd59832-b000-4de0-908d-b39a1af65284",
"Result": {
"@type": "Result",
"Error": [
    {
    "@type": "ErrorDetail",
    "StatusCode": 200,
    "Message": "COMMUNICATION ERROR",
    "SourceID": "BA",
    "SourceCode": "2599"
    "category": "UNKNOWN"
    },
    {
    "@type": "ErrorDetail",
    "StatusCode": 200,
    "Message": "COMMUNICATION ERROR",
    "SourceID": "UA",
    "SourceCode": "2599"
    "category": "UNKNOWN"
    },
    {
    "@type": "ErrorDetail",
    "StatusCode": 200,
    "Message": "COMMUNICATION ERROR",
    "SourceID": "AA",
    "SourceCode": "2599"
    "category": "UNKNOWN"
    },
    {
    "@type": "ErrorDetail",
    "StatusCode": 200,
    "Message": "COMMUNICATION ERROR",
    "SourceID": "QF",
    "SourceCode": "2599"
    "category": "UNKNOWN"
    },
    {
    "@type": "ErrorDetail",
    "StatusCode": 200,
    "Message": "COMMUNICATION ERROR",
    "SourceID": "QR",
    "SourceCode": "2599"
    "category": "UNKNOWN"
    },
    {
    "@type": "ErrorDetail",
    "StatusCode": 200,
    "Message": "COMMUNICATION ERROR",
    "SourceID": "1G",
    "SourceCode": "2599"
    "category": "UNKNOWN"
    }
]
}
}
}
```

### Error Message List

The following table lists the error messages returned in the TripServices APIs for all objects in Error/Result except SourceID, which per above may return *API*, a supplier code, or the GDS code *1G*.

The APIs may not return all error or warning messages that apply. For example, if a Search request sends invalid data for both permitted carriers and cabin classes, the API may return an error message about only one of the two invalid conditions.