public virtual object HandleException(IRequestContext requestContext, TRequest request, Exception ex) { var useAppHost = GetAppHost(); object errorResponse = null; if (useAppHost != null && useAppHost.ServiceExceptionHandler != null) { errorResponse = useAppHost.ServiceExceptionHandler(request, ex); } if (errorResponse == null) { errorResponse = DtoUtils.HandleException(useAppHost, request, ex); } AfterEachRequest(requestContext, request, errorResponse ?? ex); return(errorResponse); }