1 /* 2 * Copyright (C) 2010 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package com.android.tradefed.build; 17 18 /** 19 * A fatal error occurred while retrieving the build for testing. 20 */ 21 public class BuildRetrievalError extends Exception { 22 23 private static final long serialVersionUID = -1636070073516175229L; 24 private IBuildInfo mBuildInfo = new BuildInfo(); 25 26 /** 27 * Constructs a new {@link BuildRetrievalError} with a meaningful error message. 28 * 29 * @param reason a error message describing the cause of the error 30 */ 31 public BuildRetrievalError(String reason) { 32 super(reason); 33 } 34 35 /** 36 * Constructs a new {@link BuildRetrievalError} with a meaningful error message, and a 37 * cause. 38 * 39 * @param reason a detailed error message. 40 * @param cause a {@link Throwable} capturing the original cause of the ProvideBuildError 41 */ 42 public BuildRetrievalError(String reason, Throwable cause) { 43 super(reason, cause); 44 } 45 46 /** 47 * Constructs a new {@link BuildRetrievalError} with a meaningful error message, a 48 * cause, and build details. 49 * 50 * @param reason a detailed error message. 51 * @param cause a {@link Throwable} capturing the original cause of the ProvideBuildError 52 * @param build details about the build that was attempted to be retrieved 53 */ 54 public BuildRetrievalError(String reason, Throwable cause, IBuildInfo build) { 55 super(reason, cause); 56 mBuildInfo = build; 57 } 58 59 /** 60 * Return details about the build that was attempted to be retrieved. 61 * <p/> 62 * The returned {@link IBuildInfo} will never be null but it may be missing data such as 63 * build_id, etc 64 * 65 * @return the {@link IBuildInfo} 66 */ 67 public IBuildInfo getBuildInfo() { 68 return mBuildInfo; 69 } 70 71 /** 72 * Set the build info. 73 * 74 * @param build the {@link IBuildInfo} 75 */ 76 public void setBuildInfo(IBuildInfo build) { 77 mBuildInfo = build; 78 } 79 } 80