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

Commit b2facb8

Browse files
committed
Display more user-friendly errors.
1 parent 10317fe commit b2facb8

File tree

3 files changed

+30
-18
lines changed

3 files changed

+30
-18
lines changed

src/GitHub.App/Services/StandardUserErrors.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ public static class StandardUserErrors
138138
{ ErrorType.EnterpriseConnectFailed, Map(Defaults("Connecting to GitHub Enterprise instance failed", "Could not find a GitHub Enterprise instance at '{0}'. Double check the URL and your internet/intranet connection.")) },
139139
{ ErrorType.LaunchEnterpriseConnectionFailed, Map(Defaults("Failed to launch the enterprise connection.")) },
140140
{ ErrorType.LogFileError, Map(Defaults("Could not open the log file", "Could not find or open the log file.")) },
141-
{ ErrorType.LoginFailed, Map(Defaults("login failed", "Unable to retrieve your user info from the server. A proxy server might be interfering with the request.")) },
142-
{ ErrorType.LogoutFailed, Map(Defaults("logout failed", "Logout failed. A proxy server might be interfering with the request.")) },
141+
{ ErrorType.LoginFailed, Map(Defaults("Login failed", "Unable to retrieve your user info from the server. A proxy server might be interfering with the request.")) },
142+
{ ErrorType.LogoutFailed, Map(Defaults("Logout failed", "Logout failed. A proxy server might be interfering with the request.")) },
143143
{ ErrorType.RepoCreationAsPrivateNotAvailableForFreePlan, Map(Defaults("Failed to create private repository", "You are currently on a free plan and unable to create private repositories. Either make the repository public or upgrade your account on the website to a plan that allows for private repositories.")) },
144144
{ ErrorType.RepoCreationFailed, Map(Defaults("Failed to create repository", "An error occurred while creating the repository. You might need to open a shell and debug the state of this repo.")) },
145145
{ ErrorType.RepoExistsOnDisk, Map(Defaults("Failed to create repository", "A repository named '{0}' exists in the directory\n'{1}'.")) },

src/GitHub.TeamFoundation.14/Connect/GitHubConnectSection.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ protected void Refresh(IConnection connection)
186186
{
187187
InitializeInvitationSection();
188188

189-
ErrorMessage = connection?.ConnectionError?.Message?.Trim();
189+
ErrorMessage = connection?.ConnectionError?.GetUserFriendlyErrorMessage(ErrorType.LoginFailed);
190190
IsLoggingIn = connection?.IsLoggingIn ?? false;
191191
IsVisible = connection != null || (invitationSection?.IsVisible == false);
192192

src/GitHub.VisualStudio.UI/UI/Views/GitHubConnectContent.xaml

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
xmlns:ghfvs="https://github.com/github/VisualStudio"
77
xmlns:local="clr-namespace:GitHub.VisualStudio.UI.Views"
88
xmlns:prop="clr-namespace:GitHub.VisualStudio.UI"
9-
mc:Ignorable="d"
9+
mc:Ignorable="d"
1010
KeyboardNavigation.TabNavigation="Local"
1111
DataContext="{Binding ViewModel}"
1212
Background="{DynamicResource GitHubVsToolWindowBackground}" >
@@ -236,15 +236,32 @@
236236
Visibility="{Binding IsLoggingIn, Converter={ghfvs:BooleanToVisibilityConverter}}">
237237
Logging in...
238238
</TextBlock>
239-
240-
<DockPanel Grid.Row="1"
241-
Visibility="{Binding ErrorMessage, Converter={ghfvs:NotEqualsToVisibilityConverter {x:Null}}}">
242-
<ghfvs:OcticonImage DockPanel.Dock="Left"
239+
240+
<Grid Grid.Row="1"
241+
Visibility="{Binding ErrorMessage, Converter={ghfvs:NotEqualsToVisibilityConverter {x:Null}}}">
242+
<Grid.ColumnDefinitions>
243+
<ColumnDefinition Width="Auto"/>
244+
<ColumnDefinition Width="*"/>
245+
</Grid.ColumnDefinitions>
246+
<Grid.RowDefinitions>
247+
<RowDefinition Height="*"/>
248+
<RowDefinition Height="Auto"/>
249+
</Grid.RowDefinitions>
250+
251+
<ghfvs:OcticonImage Grid.Column="0"
252+
Grid.RowSpan="3"
243253
Icon="alert"
244-
Margin="8"
245-
VerticalAlignment="Top"/>
254+
Margin="8"/>
246255

247-
<StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal">
256+
<TextBlock Grid.Column="1"
257+
Grid.Row="0"
258+
Text="{Binding ErrorMessage}"
259+
TextWrapping="Wrap"/>
260+
261+
<StackPanel Grid.Column="1"
262+
Grid.Row="1"
263+
Margin="0,8,0,0"
264+
Orientation="Horizontal">
248265
<Button Style="{StaticResource ActionLinkButton}"
249266
Content="{x:Static prop:Resources.Retry}"
250267
Click="retry_Click"
@@ -255,12 +272,7 @@
255272
Content="{x:Static prop:Resources.SignOutLink}"
256273
Visibility="{Binding ShowLogout, Converter={StaticResource BooleanToVisibilityConverter}}"/>
257274
</StackPanel>
258-
259-
<TextBlock DockPanel.Dock="Top"
260-
Margin="0,0,0,8"
261-
Text="{x:Static prop:Resources.LoginFailedText}"/>
262-
<TextBlock Margin="0,0,0,8"
263-
Text="{Binding ErrorMessage}"/>
264-
</DockPanel>
275+
</Grid>
276+
265277
</Grid>
266278
</UserControl>

0 commit comments

Comments
 (0)