Exemplo n.º 1
0
        protected override void OnException(ExceptionContext filterContext)
        {
            //Log error
            ExceptionParameters param = new ExceptionParameters(filterContext.Exception);

            ExceptionLogic.AddException(param);
            base.OnException(filterContext);
        }
Exemplo n.º 2
0
        private static ExceptionParameters GenerateExceptionParameters <T>(Expression <Func <T> > propertyLabmda, string message, object context)
        {
            var ret = new ExceptionParameters();

            var messageParts = new List <string>();

            ret.PropertyName = ExpressionsUtils.GetPropertyName <T>(propertyLabmda);

            messageParts.Add($"paramName: {ret.PropertyName}");

            if (string.IsNullOrEmpty(message) == false)
            {
                messageParts.Add(message);
            }

            if (context != null)
            {
                messageParts.Add($"context: {JsonConvert.SerializeObject(context)}");
            }

            ret.ExcMessage = string.Join(", ", messageParts);

            return(ret);
        }