protected virtual IActionResult CreateActionResult(ExceptionContext context)
        {
            var error = ErrorFactory.CreateErrorFor(context.Exception);

            foreach (var filter in Filters)
            {
                filter.Apply(context, error);
            }
            return(new DynamicExceptionResult(error));
        }
 public void OnActionExecuted(ActionExecutedContext context)
 {
     Logger.LogTrace($"Action executed.");
     if (context.Result is BadRequestObjectResult objContext)
     {
         Logger.LogTrace($"context.Result is a BadRequestObjectResult.");
         if (objContext.Value is SerializableError serializableError)
         {
             Logger.LogInformation($"Converting SerializableError to ErrorResponse.");
             var error = ErrorFactory.CreateErrorFor(serializableError);
             context.Result = new BadRequestObjectResult(new ErrorResponse(error));
         }
     }
 }