feat: return security exception
This commit is contained in:
parent
3279ef594b
commit
0f47a98ad9
@ -5,6 +5,7 @@ using Mirea.Api.DataAccess.Application.Common.Exceptions;
|
|||||||
using Mirea.Api.Dto.Responses;
|
using Mirea.Api.Dto.Responses;
|
||||||
using Mirea.Api.Endpoint.Common.Exceptions;
|
using Mirea.Api.Endpoint.Common.Exceptions;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Security;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
@ -44,6 +45,9 @@ public class CustomExceptionHandlerMiddleware(RequestDelegate next, ILogger<Cust
|
|||||||
case ControllerArgumentException:
|
case ControllerArgumentException:
|
||||||
code = StatusCodes.Status400BadRequest;
|
code = StatusCodes.Status400BadRequest;
|
||||||
break;
|
break;
|
||||||
|
case SecurityException:
|
||||||
|
code = StatusCodes.Status401Unauthorized;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
context.Response.ContentType = "application/json";
|
context.Response.ContentType = "application/json";
|
||||||
|
Loading…
Reference in New Issue
Block a user