1 // Copyright 2014 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 package org.chromium.chrome.browser.omaha; 6 7 /** 8 * Serves as a general exception for failed POST requests to the Omaha Update Server. 9 */ 10 public class RequestFailureException extends Exception { 11 public static final int ERROR_UNDEFINED = 0; 12 public static final int ERROR_MALFORMED_XML = 1; 13 public static final int ERROR_PARSE_ROOT = 2; 14 public static final int ERROR_PARSE_RESPONSE = 3; 15 public static final int ERROR_PARSE_DAYSTART = 4; 16 public static final int ERROR_PARSE_APP = 5; 17 public static final int ERROR_PARSE_PING = 6; 18 public static final int ERROR_PARSE_EVENT = 7; 19 public static final int ERROR_PARSE_URLS = 8; 20 public static final int ERROR_PARSE_UPDATECHECK = 9; 21 public static final int ERROR_PARSE_MANIFEST = 10; 22 public static final int ERROR_CONNECTIVITY = 11; 23 24 public int errorCode = ERROR_UNDEFINED; 25 RequestFailureException(String message)26 public RequestFailureException(String message) { 27 this(message, ERROR_UNDEFINED); 28 } 29 RequestFailureException(String message, int error)30 public RequestFailureException(String message, int error) { 31 super(message); 32 errorCode = error; 33 } 34 RequestFailureException(String message, Throwable cause)35 public RequestFailureException(String message, Throwable cause) { 36 this(message, cause, ERROR_UNDEFINED); 37 } 38 RequestFailureException(String message, Throwable cause, int error)39 public RequestFailureException(String message, Throwable cause, int error) { 40 super(message, cause); 41 errorCode = error; 42 } 43 } 44