© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
8 replies
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)
// ....
// try
      var dtos = await _mediator.Send(getCentersQuery);
        return Ok(dtos);

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


or is there a better way?
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Implementing MediatR
C#CC# / help
3y ago
Exceptions.
C#CC# / help
17mo ago
✅ Exceptions
C#CC# / help
2y ago
❔ MediatR and saga
C#CC# / help
3y ago