Browse Source

Do not log domain exceptions.

pull/357/head
Sebastian Stehle 7 years ago
parent
commit
8da37979fb
  1. 4
      src/Squidex.Infrastructure/Orleans/LoggingFilter.cs
  2. 12
      tests/Squidex.Infrastructure.Tests/Orleans/LoggingFilterTests.cs

4
src/Squidex.Infrastructure/Orleans/LoggingFilter.cs

@ -29,6 +29,10 @@ namespace Squidex.Infrastructure.Orleans
{
await context.Invoke();
}
catch (DomainException)
{
throw;
}
catch (Exception ex)
{
log.LogError(ex, w => w

12
tests/Squidex.Infrastructure.Tests/Orleans/LoggingFilterTests.cs

@ -34,6 +34,18 @@ namespace Squidex.Infrastructure.Orleans
.MustNotHaveHappened();
}
[Fact]
public async Task Should_not_log_domain_exceptions()
{
A.CallTo(() => context.Invoke())
.Throws(new ValidationException("Failed"));
await Assert.ThrowsAsync<ValidationException>(() => sut.Invoke(context));
A.CallTo(() => log.Log(A<SemanticLogLevel>.Ignored, A<None>.Ignored, A<Action<None, IObjectWriter>>.Ignored))
.MustNotHaveHappened();
}
[Fact]
public async Task Should_log_exception_and_forward_it()
{

Loading…
Cancel
Save