Add global exception handling middleware to API

Introduced ExceptionHandlingMiddleware to catch and log unhandled exceptions, returning standardized JSON error responses. Registered the middleware in the request pipeline. Also made minor formatting and comment improvements in Program.cs and ICatalogRepository.cs.
This commit is contained in:
OlgunR
2026-01-19 08:31:10 +01:00
parent 353611d400
commit 289dba9b16
3 changed files with 57 additions and 2 deletions

View File

@@ -3,7 +3,7 @@ using DbFirst.Domain.Entities;
namespace DbFirst.Domain.Repositories;
// TODO: instead of creating interface per entity, consider using generic repository pattern (eg. IRepository<T>) to reduce code duplication.
//TODO: move to application layer as a part of clean architecture
// TODO: move to application layer as a part of clean architecture
public interface ICatalogRepository
{
Task<List<VwmyCatalog>> GetAllAsync(CancellationToken cancellationToken = default);