diff --git a/src/WorkFlow.API/Program.cs b/src/WorkFlow.API/Program.cs index 585c404..9cad3ae 100644 --- a/src/WorkFlow.API/Program.cs +++ b/src/WorkFlow.API/Program.cs @@ -16,6 +16,7 @@ using WorkFlow.API; using Microsoft.Extensions.Options; using DigitalData.Core.Abstractions.Security.Extensions; using DigitalData.UserManager.DependencyInjection; +using DigitalData.Core.Exceptions.Middleware; var logger = LogManager.Setup().LoadConfigurationFromAppSettings().GetCurrentClassLogger(); logger.Info("Logging initialized."); @@ -56,6 +57,8 @@ try Claims = user.ToClaimList().ToDictionary(claim => claim.Type, claim => claim.Value as object) }); + builder.Services.ConfigureGlobalExceptionHandler(); + bool disableAPIKeyAuth = config.GetValue("DisableAPIKeyAuth"); if (disableAPIKeyAuth) builder.Services.AddAPIKeyAuth(new APIKeyAuthOptions()); @@ -165,6 +168,8 @@ try app.MapControllers(); + app.UseGlobalExceptionHandler(); + app.Run(); } catch (Exception ex) diff --git a/src/WorkFlow.API/WorkFlow.API.csproj b/src/WorkFlow.API/WorkFlow.API.csproj index 724afc4..354e0de 100644 --- a/src/WorkFlow.API/WorkFlow.API.csproj +++ b/src/WorkFlow.API/WorkFlow.API.csproj @@ -22,6 +22,7 @@ +