Exceptions handling

This commit is contained in:
2024-08-18 19:53:40 +03:00
parent 3cb2083222
commit ec394a9b61
6 changed files with 73 additions and 5 deletions

View File

@@ -10,6 +10,7 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.Extensions.Options;
using Microsoft.IdentityModel.Tokens;
using SchengenVisaApi.Common;
using SchengenVisaApi.ExceptionFilters;
using Swashbuckle.AspNetCore.SwaggerGen;
namespace SchengenVisaApi;
@@ -39,7 +40,9 @@ public static class DependencyInjection
services.AddSwagger();
}
services.AddControllers();
services.AddProblemDetails();
services.AddControllers(opts => opts.Filters.Add<GlobalExceptionsFilter>());
}
/// Adds authentication, authorization and token generator