show full error messages from UpdateService

The "cause" is the Exception that was caught and embedded into the
UpdateException, so it has more info on what happened.
This commit is contained in:
Hans-Christoph Steiner 2019-05-15 22:18:53 +02:00
parent ad3fd26756
commit f0158063fb
2 changed files with 21 additions and 3 deletions

View File

@ -1129,8 +1129,21 @@ public class SwapWorkflowActivity extends AppCompatActivity {
private final BroadcastReceiver repoUpdateReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
setUpConnectingProgressText(intent.getStringExtra(UpdateService.EXTRA_MESSAGE));
String message = intent.getStringExtra(UpdateService.EXTRA_MESSAGE);
if (message == null) {
CharSequence[] repoErrors = intent.getCharSequenceArrayExtra(UpdateService.EXTRA_REPO_ERRORS);
if (repoErrors != null) {
StringBuilder msgBuilder = new StringBuilder();
for (CharSequence error : repoErrors) {
if (msgBuilder.length() > 0) {
msgBuilder.append(" + ");
}
msgBuilder.append(error);
}
message = msgBuilder.toString();
}
}
setUpConnectingProgressText(message);
ProgressBar progressBar = container.findViewById(R.id.progress_bar);
Button tryAgainButton = container.findViewById(R.id.try_again);

View File

@ -487,7 +487,12 @@ public class UpdateService extends JobIntentService {
}
} catch (IndexUpdater.UpdateException e) {
errorRepos++;
Throwable cause = e.getCause();
if (cause == null) {
repoErrors.add(e.getLocalizedMessage());
} else {
repoErrors.add(e.getLocalizedMessage() + "" + cause.getLocalizedMessage());
}
Log.e(TAG, "Error updating repository " + repo.address);
e.printStackTrace();
}