Better error messages
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<ApplicationIcon>Assets\filetime.ico</ApplicationIcon>
|
<ApplicationIcon>Assets\filetime.ico</ApplicationIcon>
|
||||||
<Version>0.0.1</Version>
|
<Version>0.0.2</Version>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
|
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
|
||||||
<DebugSymbols>true</DebugSymbols>
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
|||||||
@@ -810,7 +810,7 @@ namespace FileTime.Avalonia.Services
|
|||||||
}
|
}
|
||||||
catch (System.ComponentModel.Win32Exception e)
|
catch (System.ComponentModel.Win32Exception e)
|
||||||
{
|
{
|
||||||
_logger.LogError(e, "Error while running editor program, possible the executable path does not exists. {0}", execPath);
|
_logger.LogError(e, "Error while running editor program, possible the executable path does not exists. {ExecutablePath}", execPath);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,11 +3,13 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Avalonia.Input;
|
using Avalonia.Input;
|
||||||
|
using FileTime.App.Core.Command;
|
||||||
using FileTime.Avalonia.Application;
|
using FileTime.Avalonia.Application;
|
||||||
using FileTime.Avalonia.Configuration;
|
using FileTime.Avalonia.Configuration;
|
||||||
using FileTime.Avalonia.ViewModels;
|
using FileTime.Avalonia.ViewModels;
|
||||||
using FileTime.Core.Extensions;
|
using FileTime.Core.Extensions;
|
||||||
using FileTime.Core.Models;
|
using FileTime.Core.Models;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace FileTime.Avalonia.Services
|
namespace FileTime.Avalonia.Services
|
||||||
{
|
{
|
||||||
@@ -18,17 +20,20 @@ namespace FileTime.Avalonia.Services
|
|||||||
private readonly KeyboardConfigurationService _keyboardConfigurationService;
|
private readonly KeyboardConfigurationService _keyboardConfigurationService;
|
||||||
private readonly CommandHandlerService _commandHandlerService;
|
private readonly CommandHandlerService _commandHandlerService;
|
||||||
private readonly IDialogService _dialogService;
|
private readonly IDialogService _dialogService;
|
||||||
|
private readonly ILogger<KeyInputHandlerService> _logger;
|
||||||
|
|
||||||
public KeyInputHandlerService(
|
public KeyInputHandlerService(
|
||||||
AppState appState,
|
AppState appState,
|
||||||
KeyboardConfigurationService keyboardConfigurationService,
|
KeyboardConfigurationService keyboardConfigurationService,
|
||||||
CommandHandlerService commandHandlerService,
|
CommandHandlerService commandHandlerService,
|
||||||
IDialogService dialogService)
|
IDialogService dialogService,
|
||||||
|
ILogger<KeyInputHandlerService> logger)
|
||||||
{
|
{
|
||||||
_appState = appState;
|
_appState = appState;
|
||||||
_keyboardConfigurationService = keyboardConfigurationService;
|
_keyboardConfigurationService = keyboardConfigurationService;
|
||||||
_commandHandlerService = commandHandlerService;
|
_commandHandlerService = commandHandlerService;
|
||||||
_dialogService = dialogService;
|
_dialogService = dialogService;
|
||||||
|
_logger = logger;
|
||||||
|
|
||||||
_keysToSkip.Add(new KeyConfig[] { new KeyConfig(Key.Up) });
|
_keysToSkip.Add(new KeyConfig[] { new KeyConfig(Key.Up) });
|
||||||
_keysToSkip.Add(new KeyConfig[] { new KeyConfig(Key.Down) });
|
_keysToSkip.Add(new KeyConfig[] { new KeyConfig(Key.Down) });
|
||||||
@@ -82,7 +87,7 @@ namespace FileTime.Avalonia.Services
|
|||||||
setHandled(true);
|
setHandled(true);
|
||||||
_appState.PreviousKeys.Clear();
|
_appState.PreviousKeys.Clear();
|
||||||
_appState.PossibleCommands = new();
|
_appState.PossibleCommands = new();
|
||||||
await _commandHandlerService.HandleCommandAsync(selectedCommandBinding.Command);
|
await CallCommandAsync(selectedCommandBinding.Command);
|
||||||
}
|
}
|
||||||
else if (_keysToSkip.Any(k => AreKeysEqual(k, _appState.PreviousKeys)))
|
else if (_keysToSkip.Any(k => AreKeysEqual(k, _appState.PreviousKeys)))
|
||||||
{
|
{
|
||||||
@@ -156,7 +161,7 @@ namespace FileTime.Avalonia.Services
|
|||||||
if (selectedCommandBinding != null)
|
if (selectedCommandBinding != null)
|
||||||
{
|
{
|
||||||
setHandled(true);
|
setHandled(true);
|
||||||
await _commandHandlerService.HandleCommandAsync(selectedCommandBinding.Command);
|
await CallCommandAsync(selectedCommandBinding.Command);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,6 +199,18 @@ namespace FileTime.Avalonia.Services
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task CallCommandAsync(Commands command)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await _commandHandlerService.HandleCommandAsync(command);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
_logger.LogError(e, "Unknown error while running commnad. {Command}", command);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static bool AreKeysEqual(IReadOnlyList<KeyConfig> collection1, IReadOnlyList<KeyConfig> collection2)
|
private static bool AreKeysEqual(IReadOnlyList<KeyConfig> collection1, IReadOnlyList<KeyConfig> collection2)
|
||||||
{
|
{
|
||||||
if (collection1.Count != collection2.Count) return false;
|
if (collection1.Count != collection2.Count) return false;
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ namespace FileTime.Avalonia.Services
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
_logger.LogError(e, "Unkown exception while restoring tab. {0}", JsonSerializer.Serialize(tab, _jsonOptions));
|
_logger.LogError(e, "Unkown exception while restoring tab. {TabState}", JsonSerializer.Serialize(tab, _jsonOptions));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ namespace FileTime.Providers.Smb.Persistence
|
|||||||
}
|
}
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
_logger.LogError(e, "Unkown error while decrypting password for {0}", server.Name);
|
_logger.LogError(e, "Unkown error while decrypting password for {ServerName}", server.Name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user