From 047e3a945a309860ac6f972c987bd66d31904b1e Mon Sep 17 00:00:00 2001 From: Robert Raboud Date: Fri, 2 Mar 2018 21:54:02 -0500 Subject: [PATCH] Handled uncaught exception in command handling --- .../Commands/IdentifiedCommandHandler.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/Services/Ordering/Ordering.API/Application/Commands/IdentifiedCommandHandler.cs b/src/Services/Ordering/Ordering.API/Application/Commands/IdentifiedCommandHandler.cs index 1f0b3ddca..f00ea44c8 100644 --- a/src/Services/Ordering/Ordering.API/Application/Commands/IdentifiedCommandHandler.cs +++ b/src/Services/Ordering/Ordering.API/Application/Commands/IdentifiedCommandHandler.cs @@ -48,11 +48,16 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands else { await _requestManager.CreateRequestForCommandAsync(message.Id); - - // Send the embeded business command to mediator so it runs its related CommandHandler - var result = await _mediator.Send(message.Command); - - return result; + try + { + // Send the embeded business command to mediator so it runs its related CommandHandler + var result = await _mediator.Send(message.Command); + return result; + } + catch + { + return default(R); + } } } }