diff --git a/DisCatSharp/Net/Rest/RestClient.cs b/DisCatSharp/Net/Rest/RestClient.cs index 40bd26eb2b..1060194935 100644 --- a/DisCatSharp/Net/Rest/RestClient.cs +++ b/DisCatSharp/Net/Rest/RestClient.cs @@ -563,8 +563,7 @@ private async Task ExecuteRequestAsync(BaseRestRequest request, RateLimitBucket? case HttpStatusCode.BadRequest: case HttpStatusCode.MethodNotAllowed: ex = new BadRequestException(request, response); - // ex won't be added to avoid possible leaks - senex = new(ex.Message + "\nJson Response: " + ((ex as BadRequestException)?.JsonMessage ?? "null")); + senex = new(ex.Message + "\nJson Response: " + ((ex as BadRequestException)?.JsonMessage ?? "null"), ex); break; case HttpStatusCode.Unauthorized: @@ -629,8 +628,7 @@ private async Task ExecuteRequestAsync(BaseRestRequest request, RateLimitBucket? case HttpStatusCode.ServiceUnavailable: case HttpStatusCode.GatewayTimeout: ex = new ServerErrorException(request, response); - // ex won't be added to avoid possible leaks - senex = new(ex.Message + "\nJson Response: " + ((ex as ServerErrorException)!.JsonMessage ?? "null")); + senex = new(ex.Message + "\nJson Response: " + ((ex as ServerErrorException)!.JsonMessage ?? "null"), ex); break; }