mirror of
https://github.com/Govor-team/Govor.git
synced 2026-07-21 19:54:55 +00:00
Refactor console client to new Govor.ConsoleClient project
Removed Govor.Console implementation and introduced a new Govor.ConsoleClient project with a modular command-based architecture. Added dependency injection, command dispatcher, middleware pipeline, logging, and interactive command support. Updated solution and project files to reflect the new structure.
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
namespace Govor.ConsoleClient.Services.Middleware;
|
||||
|
||||
public class ExceptionHandlingMiddleware : ICommandMiddleware
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
|
||||
public ExceptionHandlingMiddleware(ILogger logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public async Task InvokeAsync(CommandContext context, Func<Task> next)
|
||||
{
|
||||
try
|
||||
{
|
||||
await next();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Error($"Произошла ошибка при выполнении команды '{context.Route}': {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace Govor.ConsoleClient.Services.Middleware;
|
||||
|
||||
public interface ICommandMiddleware
|
||||
{
|
||||
Task InvokeAsync(CommandContext context, Func<Task> next);
|
||||
}
|
||||
Reference in New Issue
Block a user