diff options
Diffstat (limited to 'src/com/cyanogenmod/filemanager/util/ExceptionUtil.java')
-rw-r--r-- | src/com/cyanogenmod/filemanager/util/ExceptionUtil.java | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/src/com/cyanogenmod/filemanager/util/ExceptionUtil.java b/src/com/cyanogenmod/filemanager/util/ExceptionUtil.java index 26f084f2..7b7ce745 100644 --- a/src/com/cyanogenmod/filemanager/util/ExceptionUtil.java +++ b/src/com/cyanogenmod/filemanager/util/ExceptionUtil.java @@ -29,6 +29,8 @@ import com.cyanogenmod.filemanager.FileManagerApplication; import com.cyanogenmod.filemanager.R; import com.cyanogenmod.filemanager.commands.SyncResultExecutable; import com.cyanogenmod.filemanager.commands.shell.InvalidCommandDefinitionException; +import com.cyanogenmod.filemanager.console.AuthenticationFailedException; +import com.cyanogenmod.filemanager.console.CancelledOperationException; import com.cyanogenmod.filemanager.console.CommandNotFoundException; import com.cyanogenmod.filemanager.console.ConsoleAllocException; import com.cyanogenmod.filemanager.console.ConsoleBuilder; @@ -94,7 +96,8 @@ public final class ExceptionUtil { OperationTimeoutException.class, ExecutionException.class, ParseException.class, - ActivityNotFoundException.class + ActivityNotFoundException.class, + AuthenticationFailedException.class }; private static final int[] KNOWN_EXCEPTIONS_IDS = { R.string.msgs_file_not_found, @@ -108,7 +111,8 @@ public final class ExceptionUtil { R.string.msgs_operation_timeout, R.string.msgs_operation_failure, R.string.msgs_operation_failure, - R.string.msgs_not_registered_app + R.string.msgs_not_registered_app, + 0 }; private static final boolean[] KNOWN_EXCEPTIONS_TOAST = { false, @@ -122,7 +126,8 @@ public final class ExceptionUtil { true, true, true, - false + false, + true }; /** @@ -181,6 +186,11 @@ public final class ExceptionUtil { final boolean quiet, final boolean askUser, final OnRelaunchCommandResult listener) { + // Is cancellable? + if (ex instanceof CancelledOperationException) { + return; + } + //Get the appropriate message for the exception int msgResId = R.string.msgs_unknown; boolean toast = true; @@ -216,12 +226,18 @@ public final class ExceptionUtil { @Override public void run() { try { + String msg = null; + if (fMsgResId > 0) { + msg = context.getString(fMsgResId); + } else { + msg = ex.getMessage(); + } if (fToast) { - DialogHelper.showToast(context, fMsgResId, Toast.LENGTH_SHORT); + DialogHelper.showToast(context, msg, Toast.LENGTH_SHORT); } else { AlertDialog dialog = DialogHelper.createErrorDialog( - context, R.string.error_title, fMsgResId); + context, R.string.error_title, msg); DialogHelper.delegateDialogShow(context, dialog); } } catch (Exception e) { |