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

Commit 5ff428f

Browse files
committed
Log any exceptions thrown by NoRemoteOriginCallout
Don't let any exceptions here impact other functionality.
1 parent 222f635 commit 5ff428f

File tree

1 file changed

+20
-13
lines changed

1 file changed

+20
-13
lines changed

src/GitHub.InlineReviews/Services/PullRequestStatusBarManager.cs

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -105,21 +105,28 @@ async Task RefreshCurrentSession(LocalRepositoryModel repository, IPullRequestSe
105105
[STAThread]
106106
void NoRemoteOriginCallout()
107107
{
108-
var view = FindSccStatusBar(Application.Current.MainWindow);
109-
if (view == null)
108+
try
110109
{
111-
log.Warning("Couldn't find SccStatusBar");
112-
return;
113-
}
110+
var view = FindSccStatusBar(Application.Current.MainWindow);
111+
if (view == null)
112+
{
113+
log.Warning("Couldn't find SccStatusBar");
114+
return;
115+
}
114116

115-
tippingService.Value.RequestCalloutDisplay(
116-
calloutId: Guids.NoRemoteOriginCalloutId,
117-
title: Resources.CantFindGitHubUrlForRepository,
118-
message: Resources.RepositoriesMustHaveRemoteOrigin,
119-
isPermanentlyDismissible: true,
120-
targetElement: view,
121-
vsCommandGroupId: Guids.guidGitHubCmdSet,
122-
vsCommandId: PkgCmdIDList.showGitHubPaneCommand);
117+
tippingService.Value.RequestCalloutDisplay(
118+
calloutId: Guids.NoRemoteOriginCalloutId,
119+
title: Resources.CantFindGitHubUrlForRepository,
120+
message: Resources.RepositoriesMustHaveRemoteOrigin,
121+
isPermanentlyDismissible: true,
122+
targetElement: view,
123+
vsCommandGroupId: Guids.guidGitHubCmdSet,
124+
vsCommandId: PkgCmdIDList.showGitHubPaneCommand);
125+
}
126+
catch (Exception e)
127+
{
128+
log.Error(e, nameof(NoRemoteOriginCallout));
129+
}
123130
}
124131

125132
async Task<bool> IsDotComOrEnterpriseRepository(LocalRepositoryModel repository)

0 commit comments

Comments
 (0)