Пример #1
0
        private static LoadBalanceFault Create(Exception ex)
        {
            if (ex == null)
            {
                return(null);
            }
            LoadBalanceFault   loadBalanceFault = new LoadBalanceFault();
            LocalizedException ex2 = ex as LocalizedException;

            if (ex2 != null)
            {
                loadBalanceFault.Message = ex2.LocalizedString;
            }
            else
            {
                loadBalanceFault.Message = new LocalizedString(ex.Message);
            }
            loadBalanceFault.ExceptionType  = CommonUtils.GetFailureType(ex);
            loadBalanceFault.StackTrace     = ex.StackTrace;
            loadBalanceFault.ErrorType      = (CommonUtils.IsTransientException(ex) ? LoadBalanceFault.LbErrorType.Transient : LoadBalanceFault.LbErrorType.Permanent);
            loadBalanceFault.InnerException = LoadBalanceFault.Create(ex.InnerException);
            return(loadBalanceFault);
        }
Пример #2
0
        public static void Throw(Exception ex)
        {
            LoadBalanceFault loadBalanceFault = LoadBalanceFault.Create(ex);

            throw new FaultException <LoadBalanceFault>(loadBalanceFault, loadBalanceFault.Message);
        }