diff --git a/src/ReC.API/Middleware/ExceptionHandlingMiddleware.cs b/src/ReC.API/Middleware/ExceptionHandlingMiddleware.cs index 5ca3186..db5e5f0 100644 --- a/src/ReC.API/Middleware/ExceptionHandlingMiddleware.cs +++ b/src/ReC.API/Middleware/ExceptionHandlingMiddleware.cs @@ -164,6 +164,22 @@ public class ExceptionHandlingMiddleware }; break; + case RecActionException recActionEx: + logger.LogWarning( + recActionEx, + "Rec action failed. ActionId: {ActionId}, ProfileId: {ProfileId}", + recActionEx.ActionId, + recActionEx.ProfileId); + + context.Response.StatusCode = (int)HttpStatusCode.UnprocessableEntity; + details = new() + { + Title = "Rec Action Failed", + Detail = recActionEx.InnerException?.Message + ?? "An error occurred while executing the rec action. Check the logs for more details." + }; + break; + default: logger.LogError(exception, "Unhandled exception occurred."); context.Response.StatusCode = (int)HttpStatusCode.InternalServerError;