Files
Govor/Govor.ConsoleClient/Services/Middleware/ExceptionHandlingMiddleware.cs
T
Artemy f524a9f0b7 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.
2025-07-19 19:08:21 +07:00

23 lines
582 B
C#

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}");
}
}
}