C#C
C#3y ago
barcode

✅ MediatR exceptions

I am building an API having business logic in another layer and when validation error occurs I catch it, where should I handle this exception, should I handle it in the API like
// try
      var dtos = await _mediator.Send(getCentersQuery);
        return Ok(dtos);

// catch (validationException)
// ....


or is there a better way?
Was this page helpful?