Skip to content

Commit

Permalink
fix Invoke_ShouldNotCatch_IgnoredUnhandledExceptions in UnhandledExce…
Browse files Browse the repository at this point in the history
…ptionMiddlewareTests
  • Loading branch information
m.tre committed Jun 26, 2024
1 parent 49bb09c commit 562f352
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public async Task Invoke_ShouldCatch_UnhandledExceptions()
public async Task Invoke_ShouldNotCatch_IgnoredUnhandledExceptions()
{
var result = await Client.GetAsync("canceled-bad-http-exception");

result.Response.Code.Should().Be(CanceledResponseCode);
}
#endif
Expand All @@ -55,11 +55,15 @@ protected override void SetupGlobal(IVostokAspNetCoreWebApplicationBuilder build
builder.SetupUnhandledExceptions(SetupUnhandledExceptions);
}
#endif

#if ASPNTCORE_HOSTING
protected override void SetupGlobal(Microsoft.AspNetCore.Builder.WebApplicationBuilder builder, Vostok.Hosting.AspNetCore.Web.Configuration.IVostokMiddlewaresConfigurator middlewaresConfigurator)
{
middlewaresConfigurator.ConfigureUnhandledExceptions(s => s.ErrorResponseCode = ResponseCode);
middlewaresConfigurator.ConfigureUnhandledExceptions(s =>
{
s.ErrorResponseCode = ResponseCode;
s.ExceptionsToIgnore.Add(typeof(BadHttpRequestException));
});
}
#endif

Expand Down

0 comments on commit 562f352

Please sign in to comment.