Пример #1
0
        /// <summary>
        /// Invokes all error handlers registered to the Utility
        /// </summary>
        public void ExecuteErrorHandlers <T>(T exception) where T : Exception
        {
            if (this.ErrorHeader.ErrorCode == ErrorCode.OutOfTheBox)
            {
                throw new InvalidPluginExecutionException(OperationStatus.Failed, (int)this.ErrorHeader.ErrorCode, this.ErrorHeader.ErrorMessage);
            }
            else
            {
                if (this.ErrorStack.Count == 0)
                {
                    if (typeof(T) != typeof(InvalidPluginExecutionException))
                    {
                        throw new InvalidPluginExecutionException(OperationStatus.Failed, (int)ErrorCode.Unknown, exception.Message);
                    }
                    else
                    {
                        throw exception;
                    }
                }
                else
                {
#if RELEASE
                    this.ErrorMessage = this.ErrorHeader.SupportInformation;
                    LocalContext.Trace(BuildDetailedErrorMessage().Replace(@"<br/>", string.Empty).Replace(@"<BR/>", string.Empty));
#else
                    this.errorMessage = this.BuildDetailedErrorMessage().Replace(@"<br/>", string.Empty).Replace(@"<BR/>", string.Empty);
#endif

                    throw new InvalidPluginExecutionException(OperationStatus.Failed, (int)this.ErrorHeader.ErrorCode, this.errorMessage);
                }
            }
        }