Skip to content
This repository was archived by the owner on Nov 17, 2023. It is now read-only.

Commit 047e3a9

Browse files
author
Robert Raboud
committed
Handled uncaught exception in command handling
1 parent e7dac25 commit 047e3a9

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/Services/Ordering/Ordering.API/Application/Commands/IdentifiedCommandHandler.cs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,16 @@ public async Task<R> Handle(IdentifiedCommand<T, R> message, CancellationToken c
4848
else
4949
{
5050
await _requestManager.CreateRequestForCommandAsync<T>(message.Id);
51-
52-
// Send the embeded business command to mediator so it runs its related CommandHandler
53-
var result = await _mediator.Send(message.Command);
54-
55-
return result;
51+
try
52+
{
53+
// Send the embeded business command to mediator so it runs its related CommandHandler
54+
var result = await _mediator.Send(message.Command);
55+
return result;
56+
}
57+
catch
58+
{
59+
return default(R);
60+
}
5661
}
5762
}
5863
}

0 commit comments

Comments
 (0)