Skip to content

Commit

Permalink
Update console when unable to get Google calendar timezone/reminder s…
Browse files Browse the repository at this point in the history
…ettings.

Check for quota limits error.
#1026 #1053
  • Loading branch information
phw198 committed Oct 4, 2020
1 parent cc023bb commit b92a311
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 14 deletions.
2 changes: 2 additions & 0 deletions src/OutlookGoogleCalendarSync/GoogleOgcs/GoogleCalendar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1297,6 +1297,7 @@ public void GetSettings() {
this.UTCoffset = TimezoneDB.GetUtcOffset(setting.Value);
} catch (System.Exception ex) {
OGCSexception.Analyse("Not able to retrieve Google calendar's global timezone", ex);
throw new System.ApplicationException("Unable to retrieve Google calendar's global timezone.", ex);
}
getCalendarSettings();
}
Expand All @@ -1311,6 +1312,7 @@ private void getCalendarSettings() {
this.MinDefaultReminder = cal.DefaultReminders.Where(x => x.Method.Equals("popup")).OrderBy(x => x.Minutes.Value).First().Minutes.Value;
} catch (System.Exception ex) {
OGCSexception.Analyse("Failed to get calendar settings.", ex);
throw new System.ApplicationException("Unable to retrieve Google calendar's reminder settings.", ex);
}
}

Expand Down
14 changes: 2 additions & 12 deletions src/OutlookGoogleCalendarSync/Sync/Engine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -190,18 +190,7 @@ public void Start(Boolean updateSyncSchedule = true) {
SyncResult syncResult = SyncResult.Fail;
int failedAttempts = 0;
Telemetry.TrackSync();
try {
GoogleOgcs.Calendar.Instance.GetSettings();
} catch (System.AggregateException ae) {
OGCSexception.AnalyseAggregate(ae);
syncResult = SyncResult.AutoRetry;
} catch (System.ApplicationException ex) {
mainFrm.Console.Update(ex.Message, Console.Markup.warning);
syncResult = SyncResult.AutoRetry;
} catch (System.Exception ex) {
log.Warn(ex.Message);
syncResult = SyncResult.AutoRetry;
}

while ((syncResult == SyncResult.Fail || syncResult == SyncResult.ReconnectThenRetry) && !Forms.Main.Instance.IsDisposed) {
if (failedAttempts > (syncResult == SyncResult.ReconnectThenRetry ? 1 : 0)) {
if (OgcsMessageBox.Show("The synchronisation failed - check the Sync tab for further details.\r\nDo you want to try again?", "Sync Failed",
Expand Down Expand Up @@ -388,6 +377,7 @@ private SyncResult synchronize() {
#region Read Google items
console.Update("Scanning Google calendar...");
try {
GoogleOgcs.Calendar.Instance.GetSettings();
googleEntries = GoogleOgcs.Calendar.Instance.GetCalendarEntriesInRange();
} catch (AggregateException agex) {
OGCSexception.AnalyseAggregate(agex);
Expand Down
3 changes: 1 addition & 2 deletions src/OutlookGoogleCalendarSync/Telemetry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ public enum Action {
uninstall, //squirrel
upgrade, //squirrel
version //outlook,ogcs
}

}
}
}

0 comments on commit b92a311

Please sign in to comment.