Handle operation execution errors in rendering page.

This commit is contained in:
Burak Kaan Köse
2026-02-16 01:39:53 +01:00
parent dae7d046c4
commit 31a7faeef9
@@ -17,6 +17,7 @@ using Wino.Core.Domain;
using Wino.Core.Domain.Entities.Mail; using Wino.Core.Domain.Entities.Mail;
using Wino.Core.Domain.Entities.Shared; using Wino.Core.Domain.Entities.Shared;
using Wino.Core.Domain.Enums; using Wino.Core.Domain.Enums;
using Wino.Core.Domain.Exceptions;
using Wino.Core.Domain.Interfaces; using Wino.Core.Domain.Interfaces;
using Wino.Core.Domain.Models.MailItem; using Wino.Core.Domain.Models.MailItem;
using Wino.Core.Domain.Models.Menus; using Wino.Core.Domain.Models.Menus;
@@ -42,6 +43,7 @@ public partial class MailRenderingPageViewModel : MailBaseViewModel,
private readonly IMimeFileService _mimeFileService; private readonly IMimeFileService _mimeFileService;
private readonly Core.Domain.Interfaces.IMailService _mailService; private readonly Core.Domain.Interfaces.IMailService _mailService;
private readonly IFolderService _folderService;
private readonly IFileService _fileService; private readonly IFileService _fileService;
private readonly IWinoRequestDelegator _requestDelegator; private readonly IWinoRequestDelegator _requestDelegator;
private readonly IContactService _contactService; private readonly IContactService _contactService;
@@ -145,6 +147,7 @@ public partial class MailRenderingPageViewModel : MailBaseViewModel,
IUnderlyingThemeService underlyingThemeService, IUnderlyingThemeService underlyingThemeService,
IMimeFileService mimeFileService, IMimeFileService mimeFileService,
IMailService mailService, IMailService mailService,
IFolderService folderService,
IFileService fileService, IFileService fileService,
IWinoRequestDelegator requestDelegator, IWinoRequestDelegator requestDelegator,
IStatePersistanceService statePersistenceService, IStatePersistanceService statePersistenceService,
@@ -167,6 +170,7 @@ public partial class MailRenderingPageViewModel : MailBaseViewModel,
_underlyingThemeService = underlyingThemeService; _underlyingThemeService = underlyingThemeService;
_mimeFileService = mimeFileService; _mimeFileService = mimeFileService;
_mailService = mailService; _mailService = mailService;
_folderService = folderService;
_fileService = fileService; _fileService = fileService;
_requestDelegator = requestDelegator; _requestDelegator = requestDelegator;
} }
@@ -257,6 +261,8 @@ public partial class MailRenderingPageViewModel : MailBaseViewModel,
} }
private async Task HandleMailOperationAsync(MailOperation operation) private async Task HandleMailOperationAsync(MailOperation operation)
{
try
{ {
// Toggle theme // Toggle theme
if (operation == MailOperation.DarkEditor || operation == MailOperation.LightEditor) if (operation == MailOperation.DarkEditor || operation == MailOperation.LightEditor)
@@ -323,6 +329,27 @@ public partial class MailRenderingPageViewModel : MailBaseViewModel,
await _requestDelegator.ExecuteAsync(prepRequest); await _requestDelegator.ExecuteAsync(prepRequest);
} }
} }
catch (UnavailableSpecialFolderException unavailableSpecialFolderException)
{
_dialogService.InfoBarMessage(Translator.Info_MissingFolderTitle,
string.Format(Translator.Info_MissingFolderMessage, unavailableSpecialFolderException.SpecialFolderType),
InfoBarMessageType.Warning,
Translator.SettingConfigureSpecialFolders_Button,
() =>
{
_dialogService.HandleSystemFolderConfigurationDialogAsync(unavailableSpecialFolderException.AccountId, _folderService);
});
}
catch (NotImplementedException)
{
_dialogService.ShowNotSupportedMessage();
}
catch (Exception ex)
{
Log.Error(ex, "Mail operation execution failed. Operation: {Operation}", operation);
_dialogService.InfoBarMessage(Translator.Info_RequestCreationFailedTitle, ex.Message, InfoBarMessageType.Error);
}
}
private CancellationTokenSource renderCancellationTokenSource = new CancellationTokenSource(); private CancellationTokenSource renderCancellationTokenSource = new CancellationTokenSource();