All Downloads are FREE. Search and download functionalities are using the official Maven repository.

retrofit.HttpException Maven / Gradle / Ivy

There is a newer version: 2.0.0-beta2
Show newest version
package retrofit;

/** Exception for an unexpected, non-2xx HTTP response. */
public final class HttpException extends Exception {
  private final int code;
  private final String message;
  private final transient Response response;

  public HttpException(Response response) {
    super("HTTP " + response.code() + " " + response.message());
    this.code = response.code();
    this.message = response.message();
    this.response = response;
  }

  /** HTTP status code. */
  public int code() {
    return code;
  }

  /** HTTP status message. */
  public String message() {
    return message;
  }

  /**
   * The full HTTP response. This may be null if the exception was serialized.
   */
  public Response response() {
    return response;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy