Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit b1cdf10

Browse files
committed
Log errors.
1 parent 1b94314 commit b1cdf10

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/GitHub.App/ViewModels/ActorViewModel.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
using System;
22
using System.Windows.Media.Imaging;
3+
using GitHub.Logging;
34
using GitHub.Models;
45
using GitHub.Primitives;
56
using GitHub.Services;
7+
using Serilog;
68

79
namespace GitHub.ViewModels
810
{
911
public class ActorViewModel : ViewModelBase, IActorViewModel
1012
{
1113
const string DefaultAvatar = "pack://application:,,,/GitHub.App;component/Images/default_user_avatar.png";
14+
static readonly ILogger log = LogManager.ForContext<ActorViewModel>();
1215

1316
public ActorViewModel()
1417
{
@@ -30,10 +33,13 @@ public ActorViewModel(ActorModel model)
3033
uri.Host.EndsWith("githubusercontent.com", StringComparison.OrdinalIgnoreCase))
3134
{
3235
AvatarUrl = model.AvatarUrl;
33-
Avatar = new BitmapImage(new Uri(AvatarUrl));
36+
Avatar = new BitmapImage(uri);
3437
}
3538
}
36-
catch { }
39+
catch (Exception ex)
40+
{
41+
log.Error(ex, "Invalid avatar URL");
42+
}
3743
}
3844

3945
if (AvatarUrl == null)

0 commit comments

Comments
 (0)