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 |
| 17 /* |
| 18 * A simple constructor that stores all the error handling information and m
akes it available to |
| 19 * the handler. |
| 20 * @param isTransientError Whether the error is transient and we can retry. |
| 21 * @param recoveryIntent An intent that can be used to recover from this err
or. |
| 22 * Thus, a user recoverable error is not transient, since it requires explic
it user handling |
| 23 * before retry. |
| 24 */ |
| 25 public AuthException(boolean isTransientError, Intent recoveryIntent, Except
ion exception) { |
| 26 super(exception); |
| 27 assert !isTransientError || recoveryIntent == null; |
| 28 mIsTransientError = isTransientError; |
| 29 mRecoveryIntent = recoveryIntent; |
| 30 } |
| 31 |
| 32 /* |
| 33 * @return Whether the error is transient and we can retry. |
| 34 */ |
| 35 public boolean isTransientError() { |
| 36 return mIsTransientError; |
| 37 } |
| 38 |
| 39 /* |
| 40 * @return An intent that can be used to recover from this error if it is re
coverabale by user |
| 41 * intervention, else {@code null}. |
| 42 */ |
| 43 public Intent getRecoveryIntent() { |
| 44 return mRecoveryIntent; |
| 45 } |
| 46 } |
OLD | NEW |