1 // Copyright 2011 Google Inc. All Rights Reserved.
3 package com
.google
.appengine
.tools
.admin
;
6 * A subclass of IOException that also carries the HTTP status code that
7 * generated the exception.
11 class HttpIoException
extends RemoteIOException
{
13 * Constructs an HttpIoException (a subclass of IOException that carries
14 * the HTTP status code).
16 * @param responseCode The HTTP response code.
18 HttpIoException(int responseCode
) {
20 this.responseCode
= responseCode
;
24 * Constructs an HttpIoException (a subclass of IOException that carries
25 * the HTTP status code).
27 * @param message The exception's detail message.
28 * @param responseCode The HTTP response code.
30 HttpIoException(String message
, int responseCode
) {
32 this.responseCode
= responseCode
;
36 * Constructs an HttpIoException (a subclass of IOException that carries
37 * the HTTP status code).
39 * @param message The exception's detail message.
40 * @param responseCode The HTTP response code.
41 * @param cause Another exception that caused this one, or null if none.
43 HttpIoException(String message
, int responseCode
, Throwable cause
) {
44 super(message
, cause
);
45 this.responseCode
= responseCode
;
49 * Returns The HTTP response code.
51 int getResponseCode() {
56 * Returns true if this HTTP status should be counted against the SLA. Currently, we consider
57 * that if the status is in the 500 range it is a server and should count against the SLA, but
58 * otherwise it is likely to be a problem with the user's environment and should not.
60 boolean isSlaError() {
61 return responseCode
>= 500 && responseCode
< 600;
64 private int responseCode
;