Browse Source

Add decoder exception.

pull/389/head
Sebastian Stehle 7 years ago
parent
commit
a2ecb9d47f
  1. 7
      src/Squidex.Web/ApiExceptionFilterAttribute.cs

7
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<ValidationException>(OnValidationException);
AddHandler<DecoderFallbackException>(OnDecoderException);
AddHandler<DomainObjectNotFoundException>(OnDomainObjectNotFoundException);
AddHandler<DomainObjectVersionException>(OnDomainObjectVersionException);
AddHandler<DomainForbiddenException>(OnDomainForbiddenException);
@ -34,6 +36,11 @@ namespace Squidex.Web
AddHandler<SecurityException>(OnSecurityException);
}
private static IActionResult OnDecoderException(DecoderFallbackException ex)
{
return ErrorResult(400, new ErrorDto { Message = ex.Message });
}
private static IActionResult OnDomainObjectNotFoundException(DomainObjectNotFoundException ex)
{
return new NotFoundResult();

Loading…
Cancel
Save