001    package org.hackystat.sensorbase.client;
002    
003    import org.restlet.data.Status;
004    
005    /**
006     * An exception that is thrown when the SensorBase server does not a success code. 
007     * @author Philip Johnson
008     */
009    public class SensorBaseClientException extends Exception {
010    
011      /** The default serial version UID. */
012      private static final long serialVersionUID = 1L;
013      
014      /**
015       * Thrown when an unsuccessful status code is returned from the Server.
016       * @param status The Status instance indicating the problem.
017       */
018      public SensorBaseClientException(Status status) {
019        super(status.getCode() + ": " + status.getDescription());
020      }
021    
022      /**
023       * Thrown when an unsuccessful status code is returned from the Server.
024       * @param status The status instance indicating the problem. 
025       * @param error The previous error.
026       */
027      public SensorBaseClientException(Status status, Throwable error) {
028        super(status.getCode() + ": " + status.getDescription(), error);
029      }
030      
031      /**
032       * Thrown when some problem occurs with Client not involving the server. 
033       * @param description The problem description.
034       * @param error The previous error.
035       */
036      public SensorBaseClientException(String description, Throwable error) {
037        super(description, error);
038      }
039      
040      /**
041       * Thrown when some problem occurs with Client not involving the server. 
042       * @param description The problem description.
043       */
044      public SensorBaseClientException(String description) {
045        super(description);
046      }
047    
048    }