1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-26 21:23:46 +00:00

Handle unexpected error cases on API calls better.

This commit is contained in:
Kyle Spearrin
2016-07-30 18:16:09 -04:00
parent a315f36e09
commit 6068a4bd56
5 changed files with 47 additions and 4 deletions

View File

@@ -161,13 +161,24 @@ namespace Bit.iOS.Extension
PresentViewController(loadingAlert, true, null);
await saveTask;
if(SiteListController != null)
if(saveTask.Result.Succeeded)
{
SiteListController.DismissModal();
if(SiteListController != null)
{
SiteListController.DismissModal();
}
else if(LoadingController != null)
{
LoadingController.CompleteUsernamePasswordRequest(UsernameCell.TextField.Text, PasswordCell.TextField.Text);
}
}
else if(LoadingController != null)
else if(saveTask.Result.Errors.Count() > 0)
{
LoadingController.CompleteUsernamePasswordRequest(UsernameCell.TextField.Text, PasswordCell.TextField.Text);
DisplayAlert(AppResources.AnErrorHasOccurred, saveTask.Result.Errors.First().Message, AppResources.Ok);
}
else
{
DisplayAlert(null, AppResources.AnErrorHasOccurred, AppResources.Ok);
}
}