diff --git a/src/Squidex.Web/ApiExceptionFilterAttribute.cs b/src/Squidex.Web/ApiExceptionFilterAttribute.cs index ce1b22b55..76ab8a7d9 100644 --- a/src/Squidex.Web/ApiExceptionFilterAttribute.cs +++ b/src/Squidex.Web/ApiExceptionFilterAttribute.cs @@ -9,6 +9,7 @@ using System; using System.Collections.Generic; using System.Linq; using System.Security; +using System.Text; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Filters; using Squidex.Infrastructure; @@ -27,6 +28,7 @@ namespace Squidex.Web static ApiExceptionFilterAttribute() { AddHandler(OnValidationException); + AddHandler(OnDecoderException); AddHandler(OnDomainObjectNotFoundException); AddHandler(OnDomainObjectVersionException); AddHandler(OnDomainForbiddenException); @@ -34,6 +36,11 @@ namespace Squidex.Web AddHandler(OnSecurityException); } + private static IActionResult OnDecoderException(DecoderFallbackException ex) + { + return ErrorResult(400, new ErrorDto { Message = ex.Message }); + } + private static IActionResult OnDomainObjectNotFoundException(DomainObjectNotFoundException ex) { return new NotFoundResult();