Skip to content

Commit

Permalink
Expose request URI in exception in case of failed requests
Browse files Browse the repository at this point in the history
  • Loading branch information
nvborisenko committed Jul 25, 2018
1 parent fc8e0be commit 6de087e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
8 changes: 4 additions & 4 deletions ReportPortal.Client.Tests/LaunchItem/LaunchItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
using ReportPortal.Client.Requests;
using System.Threading.Tasks;
using System.Net.Http;
using Xunit;
using Xunit;

namespace ReportPortal.Client.Tests.LaunchItem
{
{
public class LaunchItemFixture : BaseFixture
{
{
[Fact]
public async Task GetInvalidLaunch()
{
Expand All @@ -29,7 +29,7 @@ public async Task GetLaunches()

[Fact]
public async Task GetDebugLaunches()
{
{
var launches = await Service.GetLaunchesAsync(debug: true);
launches.Launches.ForEach((l) => Assert.Equal(LaunchMode.Debug, l.Mode));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ static class HttpResponseMessageExtension
{
public static void VerifySuccessStatusCode(this HttpResponseMessage httpResponseMessage)
{
var requestUri = httpResponseMessage.RequestMessage.RequestUri;
var body = httpResponseMessage.Content.ReadAsStringAsync().Result;

try
Expand All @@ -15,7 +16,7 @@ public static void VerifySuccessStatusCode(this HttpResponseMessage httpResponse
}
catch(Exception exp)
{
throw new HttpRequestException(body, exp);
throw new HttpRequestException($"Unexpected response status code. Request URI: {requestUri}{Environment.NewLine}Response Body: {body}", exp);
}
}
}
Expand Down

0 comments on commit 6de087e

Please sign in to comment.