示例#1
0
 public bool TryGetExceptionTypeFunc(Type type, out ExceptonTypeModel model)
 {
     if (exceptionTypes == null)
     {
         model = null;
         return(false);
     }
     return(exceptionTypes.TryGetValue(type, out model));
 }
        public void RegisterType <T>(Func <ExceptionContext, T, ResultModel> func, bool logFullException = false, bool logPostData = false) where T : Exception
        {
            var nfunc = new Func <ExceptionContext, Exception, ResultModel>((arg1, arg2) => {
                return(func.Invoke(arg1, arg2 as T));
            });
            var model = new ExceptonTypeModel()
            {
                ExceptionFunc    = nfunc,
                LogFullException = logFullException,
                LogPostData      = logPostData
            };
            var t = new Tuple <Type, ExceptonTypeModel>(typeof(T), model);

            typeList.Add(t);
        }