Skip to content

Commit

Permalink
fix: throw exception on null cart
Browse files Browse the repository at this point in the history
  • Loading branch information
ksavosteev committed Dec 17, 2024
1 parent bc62ec7 commit daf38fc
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
Expand All @@ -20,7 +21,8 @@ public ChangeCartCurrencyCommandHandler(ICartAggregateRepository cartAggregateRe
public override async Task<CartAggregate> Handle(ChangeCartCurrencyCommand request, CancellationToken cancellationToken)
{
// get (or create) both carts
var currentCurrencyCartAggregate = await GetOrCreateCartFromCommandAsync(request);
var currentCurrencyCartAggregate = await GetOrCreateCartFromCommandAsync(request)
?? throw new OperationCanceledException("Cart not found");

var newCurrencyCartRequest = new ChangeCartCurrencyCommand
{
Expand Down

0 comments on commit daf38fc

Please sign in to comment.