I have the below method in my controller that calls CreateProductCommand:
    public async Task<ActionResult> Create([FromBody] CreateProductCommand createProductCommand)
    {
        var userId = await Mediator.Send(createProductCommand);
        if (userId != Guid.Empty)
        {
            return Ok();
        }
        return BadRequest(); // I want command error to be displayed here
    }
My CreateProductCommand has the below:
    public async Task<Guid> Handle(CreateProductCommand request, CancellationToken cancellationToken)
    {
        // check database to see if product exists
         if(productExists)
          {
            throw Exception("Product Already Exists");
          }
     }
Is there a way to make that [ throw Exception("Product Already Exists")] be returned to the controller? At the moment the application crashes at the throw Exception line.
Thanks in advance.
 
     
     
    