Skip to content

Commit

Permalink
Don't process for Outlook error if exception contains OGCS data.
Browse files Browse the repository at this point in the history
  • Loading branch information
phw198 committed Apr 21, 2024
1 parent a44b55a commit 515a01a
Showing 1 changed file with 20 additions and 19 deletions.
39 changes: 20 additions & 19 deletions src/OutlookGoogleCalendarSync/Sync/Calendar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,26 +140,27 @@ public void StartSync(Boolean manualIgnition, Boolean updateSyncSchedule = true)
syncResult = Sync.Engine.SyncResult.AutoRetry;
}

}
Ogcs.Outlook.Errors.ErrorType error = Ogcs.Outlook.Errors.HandleComError(ex);
if (error == Ogcs.Outlook.Errors.ErrorType.RpcServerUnavailable ||
error == Ogcs.Outlook.Errors.ErrorType.RpcFailed ||
error == Ogcs.Outlook.Errors.ErrorType.InvokedObjectDisconnectedFromClients) //
{
OGCSexception.Analyse(OGCSexception.LogAsFail(ex));
String message = "It looks like Outlook was closed during the sync.";
if (error == Ogcs.Outlook.Errors.ErrorType.RpcFailed) message = "It looks like Outlook has been restarted and is not yet responsive.";
mainFrm.Console.Update(message + "<br/>Will retry syncing in a few seconds...", Console.Markup.fail, newLine: false);
syncResult = SyncResult.ReconnectThenRetry;

} else if (error == Ogcs.Outlook.Errors.ErrorType.OperationFailed) {
mainFrm.Console.Update(ex.Message, Console.Markup.fail, newLine: false);
syncResult = SyncResult.ReconnectThenRetry;

} else {
OGCSexception.Analyse(ex, true);
mainFrm.Console.UpdateWithError(null, ex, notifyBubble: true);
syncResult = SyncResult.Fail;
Ogcs.Outlook.Errors.ErrorType error = Ogcs.Outlook.Errors.HandleComError(ex);
if (error == Ogcs.Outlook.Errors.ErrorType.RpcServerUnavailable ||
error == Ogcs.Outlook.Errors.ErrorType.RpcFailed ||
error == Ogcs.Outlook.Errors.ErrorType.InvokedObjectDisconnectedFromClients) //
{
OGCSexception.Analyse(OGCSexception.LogAsFail(ex));
String message = "It looks like Outlook was closed during the sync.";
if (error == Ogcs.Outlook.Errors.ErrorType.RpcFailed) message = "It looks like Outlook has been restarted and is not yet responsive.";
mainFrm.Console.Update(message + "<br/>Will retry syncing in a few seconds...", Console.Markup.fail, newLine: false);
syncResult = SyncResult.ReconnectThenRetry;

} else if (error == Ogcs.Outlook.Errors.ErrorType.OperationFailed) {
mainFrm.Console.Update(ex.Message, Console.Markup.fail, newLine: false);
syncResult = SyncResult.ReconnectThenRetry;

} else {
OGCSexception.Analyse(ex, true);
mainFrm.Console.UpdateWithError(null, ex, notifyBubble: true);
syncResult = SyncResult.Fail;
}
}
}
}
Expand Down

0 comments on commit 515a01a

Please sign in to comment.