From d7aadf9f5a6bbbbf34970a9e55b07ff1a9c42cfd Mon Sep 17 00:00:00 2001 From: Rutherther Date: Sun, 30 Jan 2022 11:52:18 +0100 Subject: [PATCH] feat(chat): show the full result string in case of error on chat command --- .../NosSmooth.ChatCommands/ChatCommandInterceptor.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Extensions/NosSmooth.ChatCommands/ChatCommandInterceptor.cs b/src/Extensions/NosSmooth.ChatCommands/ChatCommandInterceptor.cs index 9758f7e1ff93793ba02d94b360c93f392731beb2..4397c6ca5657d17e757c1c1558aa28c26f1e417d 100644 --- a/src/Extensions/NosSmooth.ChatCommands/ChatCommandInterceptor.cs +++ b/src/Extensions/NosSmooth.ChatCommands/ChatCommandInterceptor.cs @@ -78,7 +78,7 @@ public class ChatCommandInterceptor : IPacketInterceptor { _logger.LogError($"Could not prepare \"{command}\""); _logger.LogResultError(preparedResult); - await _feedbackService.SendErrorMessageAsync($"Could not prepare the given command. {preparedResult.Error.Message}"); + await _feedbackService.SendErrorMessageAsync($"Could not prepare the given command. {preparedResult.ToFullString()}"); } var executeResult = await _commandService.TryExecuteAsync(preparedResult.Entity, _serviceProvider); @@ -86,7 +86,14 @@ public class ChatCommandInterceptor : IPacketInterceptor { _logger.LogError($"Could not execute \"{command}\""); _logger.LogResultError(executeResult); - await _feedbackService.SendErrorMessageAsync($"Could not execute the given command. {executeResult.Error.Message}"); + await _feedbackService.SendErrorMessageAsync($"Could not execute the given command. {executeResult.ToFullString()}"); + } + + if (!executeResult.Entity.IsSuccess) + { + _logger.LogError($"There was an error while handling \"{command}\""); + _logger.LogResultError(executeResult.Entity); + await _feedbackService.SendErrorMessageAsync($"Could not execute the given command. {executeResult.Entity.ToFullString()}"); } } } \ No newline at end of file