onError(IRequest, IResponse, IRequestStateElement) method

Request library uses this method in case of error/failure scenario during a request operation.

Syntax

public void onError ( IRequest aRequest , IResponse aResponse , IRequestStateElement aRequestStateElement )

Parameters

Returns

None

Example 1

public class Activity implements INetListener { ... public void onError(IRequest arg0, IResponse arg1, IRequestStateElement arg2) {

arg1.getStatusLine().toString()

arg2.getErrorCode()); } ...}

Usage

The listener registered for the request receives the request object, the HttpResponse object which contains the details about the server response, and a RequestStateElement object which provides more details about the occurred error. In case, the error occurs before sending any request to the server, the HttpResponse object will be null.