refactor(ExceptionHandlingMiddleware): update to handle ForbiddenException

This commit is contained in:
Developer 02 2025-08-05 19:44:37 +02:00
parent 6e6af4b667
commit 5f7e040e3e
2 changed files with 6 additions and 0 deletions

View File

@ -69,6 +69,11 @@ public class ExceptionHandlingMiddleware
message = notFoundEx.Message;
break;
case ForbiddenException forbidEx:
context.Response.StatusCode = (int)HttpStatusCode.Forbidden;
message = forbidEx.Message;
break;
default:
logger.LogError(exception, "Unhandled exception occurred.");
context.Response.StatusCode = (int)HttpStatusCode.InternalServerError;

View File

@ -28,6 +28,7 @@
<ItemGroup>
<PackageReference Include="DigitalData.Core.Abstraction.Application" Version="1.0.0" />
<PackageReference Include="DigitalData.Core.Application" Version="3.3.4" />
<PackageReference Include="DigitalData.Core.Exceptions" Version="1.1.0" />
<PackageReference Include="DigitalData.EmailProfilerDispatcher.Abstraction" Version="3.1.1" />
</ItemGroup>