RestException

public class RestException extends RuntimeException

Exception thrown for Http Requests in case of any exception.

Constructors

RestException

public RestException(HubException exception, List<String> errors)

Creates a new RestException instance. The exception is constructed from org.motechproject.hub.exception.HubException and list of errors that are the reason of this exception.

Parameters:
  • exception – the underlying HubException exception
  • errors – list of errors that will be treated as the reason for this exception

RestException

public RestException(HubException hubException, String reason)

Creates a new RestException instance. The exception is constructed from org.motechproject.hub.exception.HubException and a String describing exception cause.

Parameters:
  • hubException – the underlying HubException exception
  • reason – the reason of the error

Methods

getHttpStatus

public HttpStatus getHttpStatus()

Gets the HTTP status appropriate for the error that caused this exception.

Returns:the HTTP status of the error

getHubException

public HubException getHubException()

Gets the underlying HubException.

Returns:the underlying HubException

getReason

public String getReason()

Gets the reason of the error.

Returns:the reason of the error