diff --git a/src/Squidex.Infrastructure/Orleans/LoggingFilter.cs b/src/Squidex.Infrastructure/Orleans/LoggingFilter.cs index e52c1fef2..b7edc178c 100644 --- a/src/Squidex.Infrastructure/Orleans/LoggingFilter.cs +++ b/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 diff --git a/tests/Squidex.Infrastructure.Tests/Orleans/LoggingFilterTests.cs b/tests/Squidex.Infrastructure.Tests/Orleans/LoggingFilterTests.cs index d3e646f1e..28ee105e9 100644 --- a/tests/Squidex.Infrastructure.Tests/Orleans/LoggingFilterTests.cs +++ b/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(() => sut.Invoke(context)); + + A.CallTo(() => log.Log(A.Ignored, A.Ignored, A>.Ignored)) + .MustNotHaveHappened(); + } + [Fact] public async Task Should_log_exception_and_forward_it() {