Skip to content
This repository was archived by the owner on Jul 2, 2022. It is now read-only.

Commit 89b17b4

Browse files
committed
Fixed crash in RepositoriesExploreViewModel
1 parent 1f232be commit 89b17b4

1 file changed

Lines changed: 16 additions & 8 deletions

File tree

CodeHub.Core/ViewModels/Repositories/RepositoriesExploreViewModel.cs

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
using CodeFramework.Core.ViewModels;
44
using GitHubSharp.Models;
55
using System.Threading.Tasks;
6-
using CodeHub.Core.ViewModels.Repositories;
6+
using CodeHub.Core.ViewModels.Repositories;
7+
using System;
78

89
namespace CodeHub.Core.ViewModels
910
{
@@ -40,13 +41,20 @@ public ICommand SearchCommand
4041

4142
private async void Search()
4243
{
43-
await Task.Run(() =>
44-
{
45-
var request = this.GetApplication().Client.Repositories.SearchRepositories(new string[] { SearchText }, new string[] { });
46-
request.UseCache = false;
47-
var response = this.GetApplication().Client.Execute(request);
48-
Repositories.Items.Reset(response.Data.Items);
49-
});
44+
try
45+
{
46+
await Task.Run(() =>
47+
{
48+
var request = this.GetApplication().Client.Repositories.SearchRepositories(new [] { SearchText }, new string[] { });
49+
request.UseCache = false;
50+
var response = this.GetApplication().Client.Execute(request);
51+
Repositories.Items.Reset(response.Data.Items);
52+
});
53+
}
54+
catch (Exception e)
55+
{
56+
ReportError(e);
57+
}
5058
}
5159
}
5260
}

0 commit comments

Comments
 (0)