net.rim.device.api.lbs.travel
Class TravelTimeException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by net.rim.device.api.lbs.travel.TravelTimeException
Direct Known Subclasses:
TravelTimeRouteException

public class TravelTimeException
extends Exception

Represents an exception that is thrown when trying to retrieve a travel time estimate. The exception may be caused by network communication issues, a problem determining a route, or an incorrect use of the Travel Time API.

To allow for easy identification, routing-related errors are always an instance of TravelTimeRouteException.

Since:
BlackBerry API 6.0.0

Field Summary
static int NO_HTTP_CODE
          Indicates that no HTTP response code has been specified.
static int REQUEST_COMMUNICATION
          Indicates that an error occurred while attempting to communicate with the Travel Time server.
static int REQUEST_COURSE_INVALID
          Indicates an invalid course (also known as heading) has been specified.
static int REQUEST_LAT_LON_INVALID
          Indicates an invalid latitude or longitude has been specified.
static int REQUEST_MAX_PENDING_EXCEEDED
          Indicates the maximum number of pending estimate requests is exceeded.
static int REQUEST_MISSING_DATA
          Indicates data is missing from the estimate request.
static int REQUEST_SPEED_INVALID
          Indicates an invalid speed has been specified.
static int REQUEST_START_TIME_INVALID
          Indicates an invalid estimate start time has been specified.
static int ROUTING_GENERAL
          Indicates than an error occurred while computing a route.
static int ROUTING_LAT_LON
          Indicates that a route could not be computed based on the specified latitude and longitude.
static int ROUTING_ROUTE_EXCEEDS_MAX
          Indicates that the route exceeds the maximum allowable distance.
static int ROUTING_ROUTE_NOT_FOUND
          Indicates that a route could not be found.
static int ROUTING_SERVICE
          Indicates that the routing service is unavailable.
static int UNSPECIFIED
          Indicates an error for which no further detail is available.
 
Constructor Summary
TravelTimeException(int errorCode, String message)
          Constructs the exception object based on the specified error code and message.
TravelTimeException(int errorCode, String message, int httpCode)
          Constructs an exception based on an HTTP error response.
 
Method Summary
 int getErrorCode()
          Returns an error code.
 int getHttpCode()
          If the exception was due to an HTTP error, this method returns the HTTP response code.
 
Methods inherited from class java.lang.Throwable
getMessage, printStackTrace, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 



Field Detail

UNSPECIFIED

public static final int UNSPECIFIED
Indicates an error for which no further detail is available.

See Also:
Constant Field Values
Since:
BlackBerry API 6.0.0

REQUEST_MAX_PENDING_EXCEEDED

public static final int REQUEST_MAX_PENDING_EXCEEDED
Indicates the maximum number of pending estimate requests is exceeded.

See Also:
Constant Field Values
Since:
BlackBerry API 6.0.0

REQUEST_MISSING_DATA

public static final int REQUEST_MISSING_DATA
Indicates data is missing from the estimate request.

See Also:
Constant Field Values
Since:
BlackBerry API 6.0.0

REQUEST_LAT_LON_INVALID

public static final int REQUEST_LAT_LON_INVALID
Indicates an invalid latitude or longitude has been specified.

See Also:
Constant Field Values
Since:
BlackBerry API 6.0.0

REQUEST_START_TIME_INVALID

public static final int REQUEST_START_TIME_INVALID
Indicates an invalid estimate start time has been specified.

See Also:
Constant Field Values
Since:
BlackBerry API 6.0.0

REQUEST_COURSE_INVALID

public static final int REQUEST_COURSE_INVALID
Indicates an invalid course (also known as heading) has been specified.

See Also:
Constant Field Values
Since:
BlackBerry API 6.0.0

REQUEST_SPEED_INVALID

public static final int REQUEST_SPEED_INVALID
Indicates an invalid speed has been specified.

See Also:
Constant Field Values
Since:
BlackBerry API 6.0.0

REQUEST_COMMUNICATION

public static final int REQUEST_COMMUNICATION
Indicates that an error occurred while attempting to communicate with the Travel Time server.

See Also:
Constant Field Values
Since:
BlackBerry API 6.0.0

ROUTING_SERVICE

public static final int ROUTING_SERVICE
Indicates that the routing service is unavailable.

See Also:
Constant Field Values
Since:
BlackBerry API 6.0.0

ROUTING_GENERAL

public static final int ROUTING_GENERAL
Indicates than an error occurred while computing a route.

See Also:
Constant Field Values
Since:
BlackBerry API 6.0.0

ROUTING_LAT_LON

public static final int ROUTING_LAT_LON
Indicates that a route could not be computed based on the specified latitude and longitude.

See Also:
Constant Field Values
Since:
BlackBerry API 6.0.0

ROUTING_ROUTE_NOT_FOUND

public static final int ROUTING_ROUTE_NOT_FOUND
Indicates that a route could not be found.

See Also:
Constant Field Values
Since:
BlackBerry API 6.0.0

ROUTING_ROUTE_EXCEEDS_MAX

public static final int ROUTING_ROUTE_EXCEEDS_MAX
Indicates that the route exceeds the maximum allowable distance.

See Also:
Constant Field Values
Since:
BlackBerry API 6.0.0

NO_HTTP_CODE

public static final int NO_HTTP_CODE
Indicates that no HTTP response code has been specified.

See Also:
Constant Field Values
Since:
BlackBerry API 6.0.0


Constructor Detail

TravelTimeException

public TravelTimeException(int errorCode,
                           String message)
Constructs the exception object based on the specified error code and message.

Parameters:
errorCode - An error code defined by this class.
message - A message describing the problem.
Since:
BlackBerry API 6.0.0

TravelTimeException

public TravelTimeException(int errorCode,
                           String message,
                           int httpCode)
Constructs an exception based on an HTTP error response.

Parameters:
errorCode - An error code defined by this class.
message - A message describing the problem.
httpCode - An HTTP response code defined in HttpConnection
Since:
BlackBerry API 6.0.0


Method Detail

getErrorCode

public int getErrorCode()
Returns an error code.

Returns:
An error code defined in this class.
Since:
BlackBerry API 6.0.0

getHttpCode

public int getHttpCode()
If the exception was due to an HTTP error, this method returns the HTTP response code.

Returns:
A response code defined in HttpConnection. If the exception was not caused by an HTTP error, -1 is returned.
Since:
BlackBerry API 6.0.0





Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal