feat: log full Discord error body

This commit is contained in:
spiral 2022-01-26 06:21:19 -05:00
parent efaf814e12
commit b6a160caef
No known key found for this signature in database
GPG Key ID: A6059F0CA0E1BD31

View File

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