1 |
torben |
2123 |
/* Copyright (c) 2012 Google Inc. |
2 |
|
|
* |
3 |
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
4 |
|
|
* you may not use this file except in compliance with the License. |
5 |
|
|
* You may obtain a copy of the License at |
6 |
|
|
* |
7 |
|
|
* http://www.apache.org/licenses/LICENSE-2.0 |
8 |
|
|
* |
9 |
|
|
* Unless required by applicable law or agreed to in writing, software |
10 |
|
|
* distributed under the License is distributed on an "AS IS" BASIS, |
11 |
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12 |
|
|
* See the License for the specific language governing permissions and |
13 |
|
|
* limitations under the License. |
14 |
|
|
*/ |
15 |
|
|
|
16 |
|
|
package com.example.android.trivialdrivesample.util; |
17 |
|
|
|
18 |
|
|
/** |
19 |
|
|
* Exception thrown when something went wrong with in-app billing. |
20 |
|
|
* An IabException has an associated IabResult (an error). |
21 |
|
|
* To get the IAB result that caused this exception to be thrown, |
22 |
|
|
* call {@link #getResult()}. |
23 |
|
|
*/ |
24 |
|
|
public class IabException extends Exception { |
25 |
|
|
IabResult mResult; |
26 |
|
|
|
27 |
|
|
public IabException(IabResult r) { |
28 |
|
|
this(r, null); |
29 |
|
|
} |
30 |
|
|
public IabException(int response, String message) { |
31 |
|
|
this(new IabResult(response, message)); |
32 |
|
|
} |
33 |
|
|
public IabException(IabResult r, Exception cause) { |
34 |
|
|
super(r.getMessage(), cause); |
35 |
|
|
mResult = r; |
36 |
|
|
} |
37 |
|
|
public IabException(int response, String message, Exception cause) { |
38 |
|
|
this(new IabResult(response, message), cause); |
39 |
|
|
} |
40 |
|
|
|
41 |
|
|
/** Returns the IAB result (error) that this exception signals. */ |
42 |
|
|
public IabResult getResult() { return mResult; } |
43 |
|
|
} |