1
0
Fork 1
mirror of https://github.com/TeamOctolings/Octobot.git synced 2025-01-31 00:19:00 +03:00

Do not use ResultError#IsUserOrEnvironmentError (#289)

In LoggerExtensions#LogResult we skip logging the result if the error is
"user or environment error". What matches that criteria is defined by
Remora's implementation.

However, none of errors defined by the implementation should *ever* happen or be ignored:
* CommandNotFoundError: The client shouldn't send us non-existing
commands. This *can* happen because the client's command list can get
out of sync with the server's, but this happens rarely.
* AmbiguousCommandInvocationError: We don't have commands that would
trigger this error
* RequiredParameterValueMissingError: The client shouldn't send us
commands without required paremeters
* ParameterParsingError: See #220
* ConditionNotSatisfiedError: The client shouldn't send us commands that
don't satisfy our conditions

Closes #220
This commit is contained in:
Octol1ttle 2024-03-24 20:38:51 +05:00 committed by GitHub
parent 844615e8bf
commit c2f7aadaea
Signed by: GitHub
GPG key ID: B5690EEEBB952194

View file

@ -1,5 +1,4 @@
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Remora.Discord.Commands.Extensions;
using Remora.Results; using Remora.Results;
namespace Octobot.Extensions; namespace Octobot.Extensions;
@ -19,7 +18,7 @@ public static class LoggerExtensions
/// <param name="message">The message to use if this result has failed.</param> /// <param name="message">The message to use if this result has failed.</param>
public static void LogResult(this ILogger logger, IResult result, string? message = "") public static void LogResult(this ILogger logger, IResult result, string? message = "")
{ {
if (result.IsSuccess || result.Error.IsUserOrEnvironmentError()) if (result.IsSuccess)
{ {
return; return;
} }