Improve AssertLinkNotDead test output in case of exception

If the test fails with an exception other than the `EqualException` the failed URL isn't logged. This general exception handler takes care of e.g. `HttpRequestException` and reports the URL that failed to be checked.

Stumbled upon this while checking why [this test run](https://app.circleci.com/pipelines/github/btcpayserver/btcpayserver/2934/workflows/0525d9fd-e4de-49dc-957b-d98b16a9abd4/jobs/7199/parallel-runs/0/steps/0-102) fails.
This commit is contained in:
Dennis Reimann 2020-04-18 19:33:53 +02:00
parent dfe655393d
commit 03d1f98402
No known key found for this signature in database
GPG key ID: 5009E1797F03F8D0

View file

@ -158,9 +158,11 @@ namespace BTCPayServer.Tests
Assert.Equal(HttpStatusCode.OK, (await httpClient.SendAsync(request)).StatusCode);
Logs.Tester.LogInformation($"OK: {url} ({file})");
}
catch (EqualException ex)
catch (Exception ex)
{
Logs.Tester.LogInformation($"FAILED: {url} ({file}) {ex.Actual}");
var details = ex is EqualException ? (ex as EqualException).Actual : ex.Message;
Logs.Tester.LogInformation($"FAILED: {url} ({file}) {details}");
throw;
}
}