Skip to content

Commit ab4e32c

Browse files
committed
Add more logging to Source Control
1 parent fe4fe8d commit ab4e32c

File tree

6 files changed

+134
-1
lines changed

6 files changed

+134
-1
lines changed

RetailCoder.VBE/UI/RubberduckUI.Designer.cs

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

RetailCoder.VBE/UI/RubberduckUI.resx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1659,4 +1659,10 @@ All our stargazers, likers & followers, for the warm fuzzies
16591659
<data name="CodeExplorer_OpenProjectProperties" xml:space="preserve">
16601660
<value>Open project properties</value>
16611661
</data>
1662+
<data name="SourceControl_UnknownErrorMessage" xml:space="preserve">
1663+
<value>Please set your log level to Fatal or lower and create an issue on our GitHub page with the contents of your log file in C:\Users\{username}\AppData\Roaming\Rubberduck\Logs.</value>
1664+
</data>
1665+
<data name="SourceControl_UnknownErrorTitle" xml:space="preserve">
1666+
<value>An unknown error occurred.</value>
1667+
</data>
16621668
</root>

RetailCoder.VBE/UI/SourceControl/BranchesViewViewModel.cs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,12 @@ public string CurrentBranch
124124
{
125125
RaiseErrorEvent(ex.Message, ex.InnerException.Message, NotificationType.Error);
126126
}
127+
catch (Exception e)
128+
{
129+
Logger.Fatal(e);
130+
RaiseErrorEvent(RubberduckUI.SourceControl_UnknownErrorTitle,
131+
RubberduckUI.SourceControl_UnknownErrorMessage, NotificationType.Error);
132+
}
127133
OnLoadingComponentsCompleted();
128134
}
129135
}
@@ -301,6 +307,12 @@ private void CreateBranchOk()
301307
{
302308
RaiseErrorEvent(ex.Message, ex.InnerException.Message, NotificationType.Error);
303309
}
310+
catch (Exception e)
311+
{
312+
Logger.Fatal(e);
313+
RaiseErrorEvent(RubberduckUI.SourceControl_UnknownErrorTitle,
314+
RubberduckUI.SourceControl_UnknownErrorMessage, NotificationType.Error);
315+
}
304316

305317
DisplayCreateBranchGrid = false;
306318
NewBranchName = string.Empty;
@@ -330,6 +342,12 @@ private void MergeBranchOk()
330342
OnLoadingComponentsCompleted();
331343
return;
332344
}
345+
catch (Exception e)
346+
{
347+
Logger.Fatal(e);
348+
RaiseErrorEvent(RubberduckUI.SourceControl_UnknownErrorTitle,
349+
RubberduckUI.SourceControl_UnknownErrorMessage, NotificationType.Error);
350+
}
333351

334352
DisplayMergeBranchesGrid = false;
335353
RaiseErrorEvent(RubberduckUI.SourceControl_MergeStatus, string.Format(RubberduckUI.SourceControl_SuccessfulMerge, SourceBranch, DestinationBranch), NotificationType.Info);
@@ -353,6 +371,12 @@ private void DeleteBranch(bool isBranchPublished)
353371
{
354372
RaiseErrorEvent(ex.Message, ex.InnerException.Message, NotificationType.Error);
355373
}
374+
catch (Exception e)
375+
{
376+
Logger.Fatal(e);
377+
RaiseErrorEvent(RubberduckUI.SourceControl_UnknownErrorTitle,
378+
RubberduckUI.SourceControl_UnknownErrorMessage, NotificationType.Error);
379+
}
356380

357381
RefreshView();
358382
}
@@ -376,6 +400,12 @@ private void PublishBranch()
376400
{
377401
RaiseErrorEvent(ex.Message, ex.InnerException.Message, NotificationType.Error);
378402
}
403+
catch (Exception e)
404+
{
405+
Logger.Fatal(e);
406+
RaiseErrorEvent(RubberduckUI.SourceControl_UnknownErrorTitle,
407+
RubberduckUI.SourceControl_UnknownErrorMessage, NotificationType.Error);
408+
}
379409

380410
RefreshView();
381411
}
@@ -391,6 +421,12 @@ private void UnpublishBranch()
391421
{
392422
RaiseErrorEvent(ex.Message, ex.InnerException.Message, NotificationType.Error);
393423
}
424+
catch (Exception e)
425+
{
426+
Logger.Fatal(e);
427+
RaiseErrorEvent(RubberduckUI.SourceControl_UnknownErrorTitle,
428+
RubberduckUI.SourceControl_UnknownErrorMessage, NotificationType.Error);
429+
}
394430

395431
RefreshView();
396432
}

RetailCoder.VBE/UI/SourceControl/ChangesViewViewModel.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,12 @@ private void UndoChanges(IFileStatusEntry fileStatusEntry)
148148
{
149149
RaiseErrorEvent(ex.Message, ex.InnerException.Message, NotificationType.Error);
150150
}
151+
catch (Exception e)
152+
{
153+
Logger.Fatal(e);
154+
RaiseErrorEvent(RubberduckUI.SourceControl_UnknownErrorTitle,
155+
RubberduckUI.SourceControl_UnknownErrorMessage, NotificationType.Error);
156+
}
151157
}
152158

153159
private void Commit()
@@ -197,6 +203,12 @@ private void Commit()
197203
{
198204
RaiseErrorEvent(ex.Message, ex.InnerException.Message, NotificationType.Error);
199205
}
206+
catch (Exception e)
207+
{
208+
Logger.Fatal(e);
209+
RaiseErrorEvent(RubberduckUI.SourceControl_UnknownErrorTitle,
210+
RubberduckUI.SourceControl_UnknownErrorMessage, NotificationType.Error);
211+
}
200212

201213
CommitMessage = string.Empty;
202214
}

RetailCoder.VBE/UI/SourceControl/SourceControlViewViewModel.cs

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,15 @@ private void InitRepo()
601601
}
602602
catch (SourceControlException ex)
603603
{
604-
ViewModel_ErrorThrown(this, new ErrorEventArgs(ex.Message, ex.InnerException.Message, NotificationType.Error));
604+
ViewModel_ErrorThrown(this,
605+
new ErrorEventArgs(ex.Message, ex.InnerException.Message, NotificationType.Error));
606+
}
607+
catch (Exception e)
608+
{
609+
Logger.Fatal(e);
610+
ViewModel_ErrorThrown(this,
611+
new ErrorEventArgs(RubberduckUI.SourceControl_UnknownErrorTitle,
612+
RubberduckUI.SourceControl_UnknownErrorMessage, NotificationType.Error));
605613
}
606614

607615
Status = RubberduckUI.Online;
@@ -676,6 +684,14 @@ private void OpenRepo()
676684
ViewModel_ErrorThrown(null, new ErrorEventArgs(ex.Message, ex.InnerException.Message, NotificationType.Error));
677685
return;
678686
}
687+
catch (Exception e)
688+
{
689+
Logger.Fatal(e);
690+
ViewModel_ErrorThrown(this,
691+
new ErrorEventArgs(RubberduckUI.SourceControl_UnknownErrorTitle,
692+
RubberduckUI.SourceControl_UnknownErrorMessage, NotificationType.Error));
693+
}
694+
679695
OnOpenRepoCompleted();
680696

681697
AddOrUpdateLocalPathConfig(repo);
@@ -715,6 +731,13 @@ private void CloneRepo(SecureCredentials credentials = null)
715731
ViewModel_ErrorThrown(this, new ErrorEventArgs(ex.Message, ex.InnerException.Message, NotificationType.Error));
716732
return;
717733
}
734+
catch (Exception e)
735+
{
736+
Logger.Fatal(e);
737+
ViewModel_ErrorThrown(this,
738+
new ErrorEventArgs(RubberduckUI.SourceControl_UnknownErrorTitle,
739+
RubberduckUI.SourceControl_UnknownErrorMessage, NotificationType.Error));
740+
}
718741

719742
_isCloning = false;
720743
OnOpenRepoCompleted();
@@ -743,6 +766,13 @@ private void PublishRepo()
743766
{
744767
ViewModel_ErrorThrown(null, new ErrorEventArgs(ex.Message, ex.InnerException.Message, NotificationType.Error));
745768
}
769+
catch (Exception e)
770+
{
771+
Logger.Fatal(e);
772+
ViewModel_ErrorThrown(this,
773+
new ErrorEventArgs(RubberduckUI.SourceControl_UnknownErrorTitle,
774+
RubberduckUI.SourceControl_UnknownErrorMessage, NotificationType.Error));
775+
}
746776

747777
OnPropertyChanged("RepoDoesNotHaveRemoteLocation");
748778
ClosePublishRepoGrid();
@@ -810,6 +840,13 @@ private void OpenRepoAssignedToProject()
810840
_config.Repositories.Remove(_config.Repositories.FirstOrDefault(repo => repo.Id == _vbe.ActiveVBProject.HelpFile));
811841
_configService.Save(_config);
812842
}
843+
catch (Exception e)
844+
{
845+
Logger.Fatal(e);
846+
ViewModel_ErrorThrown(this,
847+
new ErrorEventArgs(RubberduckUI.SourceControl_UnknownErrorTitle,
848+
RubberduckUI.SourceControl_UnknownErrorMessage, NotificationType.Error));
849+
}
813850

814851
OnOpenRepoCompleted();
815852
}

RetailCoder.VBE/UI/SourceControl/UnsyncedCommitsViewViewModel.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,12 @@ private void FetchCommits()
106106
{
107107
RaiseErrorEvent(ex.Message, ex.InnerException.Message, NotificationType.Error);
108108
}
109+
catch (Exception e)
110+
{
111+
Logger.Fatal(e);
112+
RaiseErrorEvent(RubberduckUI.SourceControl_UnknownErrorTitle,
113+
RubberduckUI.SourceControl_UnknownErrorMessage, NotificationType.Error);
114+
}
109115
}
110116

111117
private void PullCommits()
@@ -121,6 +127,12 @@ private void PullCommits()
121127
{
122128
RaiseErrorEvent(ex.Message, ex.InnerException.Message, NotificationType.Error);
123129
}
130+
catch (Exception e)
131+
{
132+
Logger.Fatal(e);
133+
RaiseErrorEvent(RubberduckUI.SourceControl_UnknownErrorTitle,
134+
RubberduckUI.SourceControl_UnknownErrorMessage, NotificationType.Error);
135+
}
124136
}
125137

126138
private void PushCommits()
@@ -136,6 +148,12 @@ private void PushCommits()
136148
{
137149
RaiseErrorEvent(ex.Message, ex.InnerException.Message, NotificationType.Error);
138150
}
151+
catch (Exception e)
152+
{
153+
Logger.Fatal(e);
154+
RaiseErrorEvent(RubberduckUI.SourceControl_UnknownErrorTitle,
155+
RubberduckUI.SourceControl_UnknownErrorMessage, NotificationType.Error);
156+
}
139157
}
140158

141159
private void SyncCommits()
@@ -152,6 +170,12 @@ private void SyncCommits()
152170
{
153171
RaiseErrorEvent(ex.Message, ex.InnerException.Message, NotificationType.Error);
154172
}
173+
catch (Exception e)
174+
{
175+
Logger.Fatal(e);
176+
RaiseErrorEvent(RubberduckUI.SourceControl_UnknownErrorTitle,
177+
RubberduckUI.SourceControl_UnknownErrorMessage, NotificationType.Error);
178+
}
155179
}
156180

157181
private readonly ICommand _fetchCommitsCommand;

0 commit comments

Comments
 (0)