3.1.5.9 Handling Status Errors

The client MUST handle errors that occur during synchronization sessions. Errors fall into two categories: HTTP errors and ActiveSync protocol errors. HTTP errors are standard error codes, such as "401 Logon failed", and they are returned from the server in response to an HTTP POST. ActiveSync protocol errors result from a problem on the server, in an attempt to perform the task requested by the command request message. ActiveSync protocol errors are indicated by codes that are returned in the Status element (section 2.2.3.177) of a command response. For more details about the status codes, see section 2.2.2.

The client MUST implement error handling and a user interface (UI). Some errors are handled by a recovery procedure. Other errors require that an error message be displayed, along with a prompt for the user to respond. The client determines whether to run a recovery procedure or prompt for user input.

In addition to the ActiveSync protocol errors that the server sends, incomplete communication between server and client can result in the failure of a synchronization session. The server has an error recovery feature that enables a client to respond to errors by repeating the most recent synchronization session. The client MUST handle synchronization failures by retrying the synchronization. The server tracks synchronization requests to be able to respond appropriately in both of the following cases:

  • The client failed in communicating a full request to the server for synchronization.

    • In this case, the client sends a request but the server does not receive the request. The server does not act on the request, and no server-side changes occur. Therefore, no response is sent to the client. The client MUST resend a synchronization request if there is no immediate server response and neither the airsync:Wait element (section 2.2.3.198) nor the airsync:HeartbeatInterval element (section 2.2.3.88.2) was sent in the Sync request (section 2.2.1.21), or if the airsync:Wait element value or airsync:HeartbeatInterval element value was specified in the Sync request and the time has elapsed.

  • The server failed in communicating a response to the client for updates.

    • In this case, the server response is not received by the client. The client knows it has not received a response if neither the airsync:Wait element nor airsync:HeartbeatInterval element was sent in the Sync request and the server response is not received immediately, or if the airsync:Wait element value or the airsync:HeartbeatInterval element value was specified in the Sync request and that time has elapsed. The data on the server changed. The client MUST resend the request. The server recognizes the duplicate request. Because the server changes have already occurred, the server resends the response to the client to keep the server and client synchronized.