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

Commit 1815ca6

Browse files
committed
Add logging when error is shown in PR detail view
1 parent 40525e0 commit 1815ca6

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/GitHub.App/ViewModels/PullRequestDetailViewModel.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
using GitHub.UI;
1717
using LibGit2Sharp;
1818
using ReactiveUI;
19+
using NLog;
1920

2021
namespace GitHub.ViewModels
2122
{
@@ -26,6 +27,8 @@ namespace GitHub.ViewModels
2627
[PartCreationPolicy(CreationPolicy.NonShared)]
2728
public class PullRequestDetailViewModel : PanePageViewModelBase, IPullRequestDetailViewModel
2829
{
30+
static readonly Logger log = LogManager.GetCurrentClassLogger();
31+
2932
readonly IModelService modelService;
3033
readonly IPullRequestService pullRequestsService;
3134
readonly IPullRequestSessionManager sessionManager;
@@ -93,7 +96,7 @@ public PullRequestDetailViewModel(
9396
Checkout = ReactiveCommand.CreateAsyncObservable(
9497
this.WhenAnyValue(x => x.CheckoutState)
9598
.Cast<CheckoutCommandState>()
96-
.Select(x => x != null && x.IsEnabled),
99+
.Select(x => x != null && x.IsEnabled),
97100
DoCheckout);
98101
Checkout.IsExecuting.Subscribe(x => isInCheckout = x);
99102
SubscribeOperationError(Checkout);
@@ -351,6 +354,7 @@ public override void Initialize(ViewWithData data)
351354
.ObserveOn(RxApp.MainThreadScheduler)
352355
.Catch<IPullRequestModel, Exception>(ex =>
353356
{
357+
log.Error("Error observing GetPullRequest", ex);
354358
ErrorMessage = ex.Message.Trim();
355359
IsLoading = IsBusy = false;
356360
return Observable.Empty<IPullRequestModel>();
@@ -460,6 +464,7 @@ public async Task Load(IRemoteRepositoryModel remoteRepository, IPullRequestMode
460464
}
461465
catch (Exception ex)
462466
{
467+
log.Error("Error loading PullRequestModel", ex);
463468
ErrorMessage = ex.Message.Trim();
464469
}
465470
finally

0 commit comments

Comments
 (0)