public final class

ContentError

extends ErrorEvent
java.lang.Object
   ↳ com.neomades.event.Event
     ↳ com.neomades.event.ErrorEvent
       ↳ com.neomades.content.ContentError

Class Overview

Exception style class encapsulating request errors.

Summary

Constants
String TYPE Event type
[Expand]
Inherited Constants
From class com.neomades.event.ErrorEvent
Public Methods
ContentException getException()
Returns the associated exception thrown by the query.
String getMessage()
NetworkResponse getNetworkResponse()
Returns the network response corresponding to this error.
ContentQuery getQuery()
Gets the associated query to know which query has failed.
boolean isAuthenticationError()
Error indicating that there was an authentication failure when performing a query.
boolean isNetworkError()
Indicates that there was a network error when performing a query.
boolean isNoConnectionError()
Error indicating that no connection could be established when performing a query.
boolean isParseError()
Indicates that the server's response could not be parsed.
boolean isServerError()
Indicates that the error responded with an error response.
boolean isTimeoutError()
Indicates that the connection or the socket timed out.
[Expand]
Inherited Methods
From class com.neomades.event.ErrorEvent
From class com.neomades.event.Event
From class java.lang.Object

Constants

public static final String TYPE

Event type

Constant Value: "com.neomades.content.ContentError"

Public Methods

public String getMessage ()

Returns
  • the associated message

public NetworkResponse getNetworkResponse ()

Returns the network response corresponding to this error. This method always return a valid object (even in the case of a timeout error).

Returns
  • the server response

public ContentQuery getQuery ()

Gets the associated query to know which query has failed.

To know the reason of the failure, use isNetworkError() for example or getException()

Returns
  • the associated query. (may be null)

public boolean isAuthenticationError ()

Error indicating that there was an authentication failure when performing a query.

The server has refused to accept authentication (e.g. HTTP 401 or HTTP 403 from HttpNetwork) or the Network implementation has thrown an AuthenticateException.

Returns
  • true if the server has failed during authentication.

public boolean isNetworkError ()

Indicates that there was a network error when performing a query.

An unexpected error occurred in the Network implementation.

Returns
  • true if the error is caused by the network implementation.

public boolean isNoConnectionError ()

Error indicating that no connection could be established when performing a query.

A connection cannot be established with the server because the network connectivity does not exist and the device could not establish connections and pass data.

The Network implementation has thrown an NoConnectionException.

Returns
  • true if the error means that there is no connection

public boolean isParseError ()

Indicates that the server's response could not be parsed.

An parsing error occurred in the Parser implementation.

Returns
  • true if the error is caused by the server response parsing

public boolean isServerError ()

Indicates that the error responded with an error response.

The server encountered an unexpected error when executing the request given by the client (e.g. HTTP 5XX code response from HttpNetwork or ServerException thrown in the Network implementation).

Returns
  • true if the error is coming from server

public boolean isTimeoutError ()

Indicates that the connection or the socket timed out.

The query operation takes too long time to be realized.

Returns
  • true if the error is timeout