Error Management

Error Management

This page offers a general guideline to handle the errors returned by the API functions.

There are essentially two types of function calls provided by the API Proxy. Technical function calls, such as those dealing with conversation management, memory management and diagnostics, and application function calls providing access to the range of Amadeus Central System travel products.

Examples of technical function calls are CAI_openConversationByCorporateId or CAI_setTrace.

Examples of application functional calls are CAI_sendAndReceiveXml (this is the only one in the C-XML flavour) or CAI_PoweredAirMultiAvailability (infact there is one for each Amadeus Central System product in the C-Container flavour).

1 - Check the return code

All API function calls provide a return code. For technical functions the return code CAI_OK indicates that the transaction completed successfully, any other return code value is an error.

For application functions, the return code CAI_OK indicates that the transaction completed successfully. Apart from the special case of CAI_FUNCTIONAL_ERROR any other return code value is an error.

For the return code CAI_FUNCTIONAL_ERROR, the transaction completed successfully (in the sense that the query was received by the Amadeus Central System application, and it has responded), however the application has responded with a functional error. In certain cases, such errors may actually be expected, e.g. 'QUEUE EMPTY'.

The possible values for the return codes are provided in the following list [5 - Annex].

2 - Get the API Dump

The API Dump can be used to find out more information concerning an error. The API Dump is a representation of the internal state of the API when the error occurred.
Its content is for Amadeus API Development and Marketing use only. We recommend you to provide its output when querying support to Amadeus.

During the development stage,
we suggest you to get the API dump on every return code different to CAI_OK.
During the production stage, only the following return codes need to be completed with an API Dump output :
- CAI_LOCAL_ERROR
- CAI_COMM_ERROR
- CAI_INTERNAL_ERROR.

To get it, call the CAI_getConversationDump() function (located in the 'CAI_Conversation.h' header file) after a return code different from CAI_OK.

3 - Analyzing the MessagesOnly_Reply

The MessageOnly_Reply concerns application function calls only.
After a transaction has completed, check for the 'CAPI_MessagesOnlyReply' structure or XML tag. If the return code is not CAI_OK this output structure or XML document can be populated with additional details on the error.
It can be repeated several times, providing several levels of information according to the error.
The error level is detailed in the field 'LineType':

Value Description
E or EC Error.

In the case of a return code CAI_FUNCTIONAL_ERROR a non-exhaustive list of possible application values for the 'ErrorCode' field are provided in the following list.

It is also possible to receive a MessageOnly_Response with a return code of CAI_OK. Here the message can be flagged as either a warning, or informational.

Value Description
W or WEC Warning
I or INF Infomation

4 - Release of the memory

The release of the input structure (or XML document) can be done just after the API function call.
The release of the output structure (or XML document) must be done:

  • After the API function call,
  • Whatever the return code is (except CAI_BAD_ARGS & CAI_ENTRY_IN_PROGRESS).

     

    5 - Annex

    The set of return codes is defined in the enum type named 'CaiErr' located in the 'CAI_Conversation.h' header file.


    Return Code (Error number) Description Action
    CAI_OK ( 0 ) Operation was successful. No action required.
    CAI_INTERNAL_ERROR ( 1 ) The API Proxy is experiencing difficulties Re-try few minutes later, then contact your support.
    CAI_BAD_ARGS ( 2 ) One or several arguments passed to the function are not set properly. For example a call to:
    CAI_sendAndReceiveXml
    (CAI_Conversation *conversation,
               CAI_XML_BUFFER xmlQuery,  
               CAI_XML_BUFFER *xmlReply)
    with a NULL conversation handle returns CAI_BAD_ARGS.
    Refer to the synopsis of the function in the reference guide and review your code.
    CAI_LOCAL_ERROR ( 3 ) The error is located in the API proxy. This mostly occurs when the query is not compliant with the documentation. This can also occur when the response from the Amadeus Central System is not compliant with the documentation. If the problem is the query, then refer to the synopsis of the query in the reference guide, otherwise contact your support.
    CAI_COMM_ERROR ( 4 ) Problem at the communication layer. Retry few minutes later, Check your links, then contact your support.

    If the COMM_ERROR message is returned when opening a conversation, this may be due to a wrong definition of the OfficeID.
    Look at the API dump (see CAI_getConversationDump()) and look for a CONTRL line. If it ends with 4 11 then your message is rejected because of a problem of security (most likely of OfficeID).
    In any case, the content of the dump is required to investigate the origin of the problem.
    CAI_RTO ( 5 ) Response time-out. Re-try few minutes later, then contact your support.
    CAI_ITO ( 6 ) Inactivity time-out. Close the conversation and open a new one.
    CAI_CONVERSATION_ERROR ( 7 ) The Amadeus Central System resource is not available. Close the conversation and open a new one.
    CAI_SERVER_ERROR ( 8 ) The API Server is experiencing difficulties. Re-try few minutes later, then contact your support.
    CAI_INVALID_CORPORATE ( 9 ) The given corporate id is not defined. Check this argument, then contact your support.
    CAI_INVALID_US ER ( 10 ) The given user id is not defined. Check the corporate id, then contact your support.
    CAI_INVALID_PASSWORD ( 11 ) The given password is not defined. Check the corporate id, then contact your support.
    CAI_INVALID_ATID( 12 ) The given atid is not defined. Check the corporate id, then contact your support.
    CAI_INTERFACE_NOT_DEFINED ( 13 ) The used interface is not defined. Contact your support.
    CAI_ENTRY_IN_PROGRESS ( 14 ) The API proxy conversation is waiting for a reply from the Amadeus Central System. You can not send another query on this conversation until it has completed sucessfully, or timed-out. Re-try a few minutes later.
    CAI_UNKNOWN_TRANSACTION ( 15  ) The called transaction is not defined. Contact your support.
    CAI_FUNCTIONAL_ERROR ( 16 ) The Application, hosted on the Amadeus Central System, is responding with an error. In most cases, the transaction completed successfully (the query reached the host application, and a reply was returned) however, the application is indicating that an error has occured. Check the functional consistency of your query. Certain functional error messages may be expected (e.g. 'QUEUE EMPTY') Certain messages may not be (e.g. 'CHECK CALL SUPERVISOR') so you may need to contact your support.
    CAI_INVALID_FILE ( 17 ) This error occurs if the file and path names supplied for the log file are incorrect Correct file name and directory path.
    Avoid using special characters
    CAI_PASSIVE ( 18 ) Invalid use of the serialization. You try to unserialize a context on an active conversation or try to send a message over a passive conversation. Check your serialization logic.
    CAI_CORRUPTED_CONTEXT ( 19  ) The serialized context is not valid. Check this argument, then contact your support.
    CAI_INVALID_SKA ( 20 ) Only For commonAPI Invalid SKA segment, will never occur with Amadeus connection.
    CAI_UNSUPPORTED_OPERATION ( 21  ) The operation is not supported. Contact your support.

    CAI_CORRUPT_

    CONVERSATION_HANDLE ( 22 )

    The Conversation handle passed to the Proxy function is not valid. Refer to the synopsis of the function in the reference guide and review your code.
    CAI_INVALID_CUSTOM_SIGN_IN ( 23 ) Invalid CAI_CustomSign parameters (e.g. office_id,agt_sign). Check the length of the CAI_CustomSign parameters.

    CAI_UNAUTHORIZED_

    CUSTOM_SIGN_IN ( 24 )

    Unauthorized use of CAI_CustomSign parameters (e.g. office_id,agt_sign). Contact your support if you wish to use the restricted CAI_CustomSign parameters
    CAI_COMM_ERROR_TRY_RESEND ( 25 ) Attempt has been made to reconnect and retry sending a query, but this second attempt has failed. This error can be treated as a CAI_COMM_ERROR.