public IMethodReturn Invoke(IMethodInvocation input, GetNextInterceptionBehaviorDelegate getNext) { IMethodReturn result = getNext()(input, getNext); if (result.Exception != null) { _logger.Error(result.Exception); if (result.ReturnValue == null) { MethodInfo m = input.MethodBase as MethodInfo; if (m != null) { IServiceResponse response = Activator.CreateInstance(m.ReturnType) as IServiceResponse; if (response != null) { response.SetError(result.Exception); result.ReturnValue = response; result.Exception = null; } } } } return(result); }