Synchronizer error factory implementation (#645)
* Added sync error factories for outlook and gmail. * Implement ObjectCannotBeDeletedHandler for OutlookSynchronizer. * Remove debug code. * Implement del key to delete on mail list. * Revert debug code.
This commit is contained in:
32
Wino.Core/Domain/Interfaces/ISynchronizerErrorHandler.cs
Normal file
32
Wino.Core/Domain/Interfaces/ISynchronizerErrorHandler.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using System.Threading.Tasks;
|
||||
using Wino.Core.Domain.Models.Errors;
|
||||
|
||||
namespace Wino.Core.Domain.Interfaces;
|
||||
|
||||
/// <summary>
|
||||
/// Interface for handling specific synchronizer errors
|
||||
/// </summary>
|
||||
public interface ISynchronizerErrorHandler
|
||||
{
|
||||
/// <summary>
|
||||
/// Determines if this handler can handle the specified error
|
||||
/// </summary>
|
||||
/// <param name="error">The error to check</param>
|
||||
/// <returns>True if this handler can handle the error, false otherwise</returns>
|
||||
bool CanHandle(SynchronizerErrorContext error);
|
||||
|
||||
/// <summary>
|
||||
/// Handles the specified error
|
||||
/// </summary>
|
||||
/// <param name="error">The error to handle</param>
|
||||
/// <returns>A task that completes when the error is handled</returns>
|
||||
Task<bool> HandleAsync(SynchronizerErrorContext error);
|
||||
}
|
||||
|
||||
public interface ISynchronizerErrorHandlerFactory
|
||||
{
|
||||
Task<bool> HandleErrorAsync(SynchronizerErrorContext error);
|
||||
}
|
||||
|
||||
public interface IOutlookSynchronizerErrorHandlerFactory : ISynchronizerErrorHandlerFactory;
|
||||
public interface IGmailSynchronizerErrorHandlerFactory : ISynchronizerErrorHandlerFactory;
|
||||
42
Wino.Core/Domain/Models/Errors/SynchronizerErrorContext.cs
Normal file
42
Wino.Core/Domain/Models/Errors/SynchronizerErrorContext.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Wino.Core.Domain.Entities.Shared;
|
||||
using Wino.Core.Domain.Interfaces;
|
||||
|
||||
namespace Wino.Core.Domain.Models.Errors;
|
||||
|
||||
/// <summary>
|
||||
/// Contains context information about a synchronizer error
|
||||
/// </summary>
|
||||
public class SynchronizerErrorContext
|
||||
{
|
||||
/// <summary>
|
||||
/// Account associated with the error
|
||||
/// </summary>
|
||||
public MailAccount Account { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the error code
|
||||
/// </summary>
|
||||
public int? ErrorCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the error message
|
||||
/// </summary>
|
||||
public string ErrorMessage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the request bundle associated with the error
|
||||
/// </summary>
|
||||
public IRequestBundle RequestBundle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets additional data associated with the error
|
||||
/// </summary>
|
||||
public Dictionary<string, object> AdditionalData { get; set; } = new Dictionary<string, object>();
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the exception associated with the error
|
||||
/// </summary>
|
||||
public Exception Exception { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user