Skip to content

Commit fbd175a

Browse files
authored
refactor: rethrow exception without losing stack trace (#96)
1 parent f5181d8 commit fbd175a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Cnblogs.Architecture.Ddd.Infrastructure.Abstractions/DispatchDomainEventExtensions.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System.Runtime.ExceptionServices;
12
using Cnblogs.Architecture.Ddd.Domain.Abstractions;
23

34
// ReSharper disable once CheckNamespace
@@ -30,7 +31,7 @@ public static async Task DispatchDomainEventsAsync(this IMediator mediator, IEnu
3031

3132
if (e is not null)
3233
{
33-
throw e;
34+
ExceptionDispatchInfo.Capture(e).Throw();
3435
}
3536
}
3637
}

0 commit comments

Comments
 (0)