Ejemplo n.º 1
0
        private static Type GetExceptionType(IQueryExceptionHandler <TRequest, TResponse> handler)
        {
            var interfaceType = ReflectionBridge
                                .FindInterfaces(
                handler.GetType(),
                x => ReflectionBridge.CheckIsGeneric(x) &&
                x.GetGenericTypeDefinition() == typeof(IQueryExceptionHandler <, ,>)
                )
                                .SingleOrDefault();

            return(interfaceType is null
                ? typeof(Exception)
                : ReflectionBridge.GetGenericArguments(interfaceType)[2]);
        }
Ejemplo n.º 2
0
 public ExceptionHandlerWrapper(IQueryExceptionHandler <TRequest, TResponse> handler)
 {
     Handler       = handler;
     ExceptionType = GetExceptionType(Handler);
 }