Esempio n. 1
0
        ExceptionPolicyEntry FindExceptionPolicyEntry(Type exceptionType)
        {
            ExceptionPolicyEntry entry = null;

            while (exceptionType != typeof(Object))
            {
                entry = GetPolicyEntry(exceptionType);

                if (entry != null)
                {
                    break;
                }
                else
                {
                    exceptionType = exceptionType.BaseType;
                }
            }

            return(entry);
        }
Esempio n. 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="originalException"></param>
        /// <param name="bizInfo"></param>
        /// <returns></returns>
        public bool HandleException(Exception originalException, IDictionary bizInfo)
        {
            ArgumentAssertion.IsNotNull(originalException, "originalException");

            ExceptionPolicyEntry entry = GetPolicyEntry(originalException);

            if (entry == null)
            {
                return(true);
            }

            originalException = FindOriginalException(originalException);

            if ((originalException is HostileRequestException) == false && HttpContext.Current != null && HttpValidator.IsCrawlerRequest(HttpContext.Current.Request))
            {
                var msg = string.Format("[CrawlerRequest]{0}", originalException.Message);
                originalException = new HostileRequestException(msg, originalException);
                entry             = GetPolicyEntry(originalException);
            }

            return(entry.Handle(originalException, bizInfo));
        }