Home | History | Annotate | Download | only in targetprep
      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.targetprep;
     17 
     18 import com.android.tradefed.command.remote.DeviceDescriptor;
     19 
     20 /**
     21  * Thrown if the provided build fails to run.
     22  */
     23 @SuppressWarnings("serial")
     24 public class BuildError extends Exception {
     25 
     26     private DeviceDescriptor mDescriptor = null;
     27 
     28     /**
     29      * Constructs a new (@link BuildError} with a detailed error message.
     30      *
     31      * @param reason an error message giving more details on the build error
     32      * @param descriptor the descriptor of the device concerned
     33      */
     34     public BuildError(String reason, DeviceDescriptor descriptor) {
     35         super(reason + " " + descriptor);
     36         mDescriptor = descriptor;
     37     }
     38 
     39     /**
     40      * Constructs a new (@link BuildError} with a detailed error message.
     41      *
     42      * @param reason an error message giving more details on the build error
     43      * @deprecated use {@link #BuildError(String, DeviceDescriptor)} instead.
     44      */
     45     @Deprecated
     46     public BuildError(String reason) {
     47         super(reason);
     48     }
     49 
     50     /**
     51      * Return the descriptor of the device associated with exception.
     52      */
     53     public DeviceDescriptor getDeviceDescriptor() {
     54         return mDescriptor;
     55     }
     56 }
     57