feat: log full Discord error body

This commit is contained in:
spiral
2022-01-26 06:21:19 -05:00
parent efaf814e12
commit b6a160caef

View File

@@ -231,8 +231,11 @@ public class BaseRestClient: IAsyncDisposable
var body = await response.Content.ReadAsStringAsync();
var apiError = TryParseApiError(body);
if (apiError != null)
{
using var _ = LogContext.PushProperty("DiscordErrorBody", body);
_logger.Warning("Discord API error: {DiscordErrorCode} {DiscordErrorMessage}", apiError.Code,
apiError.Message);
}
throw CreateDiscordException(response, body, apiError);
}