From a2ecb9d47fc799f9ddcccdbaef7170351ee31f58 Mon Sep 17 00:00:00 2001 From: Sebastian Stehle Date: Fri, 19 Jul 2019 19:13:03 +0200 Subject: [PATCH] Add decoder exception. --- src/Squidex.Web/ApiExceptionFilterAttribute.cs | 7 +++++++ 1 file changed, 7 insertions(+) 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();