OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 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.sync.signin; | |
6 | |
7 import android.content.Intent; | |
8 | |
9 /* | |
10 * AuthException abstracts away authenticator specific exceptions behind a singl e interface. | |
11 * It is used for passing information that is useful for better handling of erro rs. | |
12 */ | |
13 public class AuthException extends Exception { | |
14 private final boolean mIsTransientError; | |
15 private final Intent mRecoveryIntent; | |
16 private final Exception mInnerException; | |
17 | |
18 /* | |
19 * A simple constructor that stores all the error handling information and m akes it available to | |
20 * the handler. | |
21 * @param isTransientError Whether the error is transient and we can retry. | |
22 * @param recoveryIntent An intent that can be used to recover from this err or. | |
23 * Thus, a user recoverable error is not transient, since it requires explic it user handling | |
24 * before retry. | |
25 */ | |
26 public AuthException(boolean isTransientError, Intent recoveryIntent, Except ion exception) { | |
27 assert !isTransientError || recoveryIntent == null; | |
28 assert exception != null; | |
29 mIsTransientError = isTransientError; | |
30 mRecoveryIntent = recoveryIntent; | |
31 mInnerException = exception; | |
Bernhard Bauer
2015/11/20 18:55:42
You could pass this one to the super constructor i
knn
2015/11/23 11:35:32
Done.
| |
32 } | |
33 | |
34 /* | |
35 * @return Whether the error is transient and we can retry. | |
36 */ | |
37 public boolean isTransientError() { | |
38 return mIsTransientError; | |
39 } | |
40 | |
41 /* | |
42 * @return An intent that can be used to recover from this error if it is re coverabale by user | |
43 * intervention, else {@code null}. | |
44 */ | |
45 public Intent getRecoveryIntent() { | |
46 return mRecoveryIntent; | |
47 } | |
48 | |
49 /* | |
50 * @return The original exception that is encapsulated by this AuthException . | |
51 * Used for logging. | |
52 */ | |
53 public Exception getInnerException() { | |
54 return mInnerException; | |
55 } | |
56 } | |
OLD | NEW |