Skip to content

Commit 0170f57

Browse files
authored
chore(Dispatcher): Adjust exception handling information (#23)
1 parent 095403a commit 0170f57

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

src/Dispatcher/Masa.Contrib.Dispatcher.Events/Internal/Dispatch/DispatcherBase.cs

+1-5
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,9 @@ await executionStrategy.ExecuteAsync(strategyOptions, @event, async (@event) =>
6666
{
6767
isCancel = true;
6868
if (dispatchRelation.CancelHandlers.Any())
69-
{
7069
await ExecuteEventCanceledHandlerAsync(serviceProvider, Logger, executionStrategy, dispatchRelation.CancelHandlers, @event);
71-
}
7270
else
73-
{
74-
throw ex;
75-
}
71+
throw new Exception(ex.Message, ex);
7672
}
7773
else
7874
{

src/Dispatcher/Masa.Contrib.Dispatcher.Events/Strategies/ExecutionStrategy.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ public async Task ExecuteAsync<TEvent>(StrategyOptions strategyOptions, TEvent @
2727
{
2828
if (retryTimes > 0)
2929
{
30-
_logger?.LogWarning("----- Error Publishing event {@Event} finish: The {retries}th retrying consume a message failed. message id: {messageId} -----", @event, retryTimes, @event.Id);
30+
_logger?.LogError(ex, "----- Error Publishing event {@Event} finish: The {retries}th retrying consume a message failed. message id: {messageId} -----", @event, retryTimes, @event.Id);
3131
}
3232
else
3333
{
34-
_logger?.LogWarning(ex, "----- Error Publishing event {@Event}: after {retries}th executions and we will stop retrying. message id: {messageId} -----", @event, strategyOptions.MaxRetryCount, @event.Id);
34+
_logger?.LogError(ex, "----- Error Publishing event {@Event}: after {maxRetries}th executions and we will stop retrying. message id: {messageId} -----", @event, strategyOptions.MaxRetryCount, @event.Id);
3535
}
3636
exception = ex;
3737
retryTimes++;

0 commit comments

Comments
 (0)