Exemplo n.º 1
0
        // Token: 0x060008BD RID: 2237 RVA: 0x0002A398 File Offset: 0x00028598
        public static void ThrowDagTaskOperationWrapper(Exception exception)
        {
            if (exception == null)
            {
                return;
            }
            string text = string.Empty;
            IHaRpcServerBaseException ex = exception as IHaRpcServerBaseException;

            if (ex != null)
            {
                text = ex.ErrorMessage;
            }
            else
            {
                text = exception.Message;
            }
            if (exception is ClusterException)
            {
                throw new DagTaskOperationFailedException(text, exception);
            }
            if (exception is TransientException)
            {
                throw new DagTaskServerTransientException(text, exception);
            }
            throw new DagTaskOperationFailedException(text, exception);
        }
        internal static string GetFullString(IHaRpcServerBaseException ex, IHaRpcServerBaseExceptionInternal exInternal)
        {
            StringBuilder stringBuilder = new StringBuilder(2048);

            stringBuilder.AppendFormat("{0}: {1}", ex.GetType(), exInternal.MessageInternal);
            if (ex.InnerException != null)
            {
                stringBuilder.Append(" ---> ");
                stringBuilder.Append(ex.InnerException.ToString());
                stringBuilder.AppendLine();
                stringBuilder.Append(string.Format("   --- End of inner exception stack trace ({0}) ---", ex.InnerException.GetType()));
            }
            if (!string.IsNullOrEmpty(ex.OriginatingStackTrace))
            {
                stringBuilder.AppendLine();
                stringBuilder.Append(ex.OriginatingStackTrace);
            }
            if (!string.IsNullOrEmpty(ex.OriginatingServer))
            {
                stringBuilder.AppendLine();
                stringBuilder.Append(string.Format("   --- End of stack trace on server ({0}) ---", ex.OriginatingServer));
            }
            if (!string.IsNullOrEmpty(ex.StackTrace))
            {
                stringBuilder.AppendLine();
                stringBuilder.Append(ex.StackTrace);
            }
            return(stringBuilder.ToString());
        }
Exemplo n.º 3
0
        public void ClientRethrowIfFailed(string databaseName, string serverName, RpcErrorExceptionInfo errorInfo)
        {
            Exception ex   = null;
            string    text = HaRpcExceptionWrapperBase <TBaseException, TBaseTransientException> .SanitizeServerName(serverName);

            if (errorInfo.IsFailed())
            {
                if (errorInfo.ReconstitutedException != null)
                {
                    ex = this.ConstructClientExceptionFromServerException(text, errorInfo.ReconstitutedException);
                }
                else
                {
                    if (errorInfo.SerializedException != null && errorInfo.SerializedException.Length > 0)
                    {
                        try
                        {
                            errorInfo.ReconstitutedException = SerializationServices.Deserialize <Exception>(errorInfo.SerializedException);
                            ex = this.ConstructClientExceptionFromServerException(text, errorInfo.ReconstitutedException);
                            goto IL_109;
                        }
                        catch (SerializationException innerException)
                        {
                            ex = this.GetGenericOperationFailedException(errorInfo.ErrorMessage, innerException);
                            ((TBaseException)((object)ex)).OriginatingServer = text;
                            goto IL_109;
                        }
                        catch (TargetInvocationException innerException2)
                        {
                            ex = this.GetGenericOperationFailedException(errorInfo.ErrorMessage, innerException2);
                            ((TBaseException)((object)ex)).OriginatingServer = text;
                            goto IL_109;
                        }
                    }
                    if (!string.IsNullOrEmpty(errorInfo.ErrorMessage))
                    {
                        ex = this.GetGenericOperationFailedException(errorInfo.ErrorMessage);
                        ((TBaseException)((object)ex)).OriginatingServer = text;
                    }
                    else
                    {
                        ex = this.GetGenericOperationFailedWithEcException(errorInfo.ErrorCode);
                        ((TBaseException)((object)ex)).OriginatingServer = text;
                    }
                }
IL_109:
                IHaRpcServerBaseException ex2 = ex as IHaRpcServerBaseException;
                if (ex2 != null && string.IsNullOrEmpty(ex2.DatabaseName) && !string.IsNullOrEmpty(databaseName))
                {
                    ((IHaRpcServerBaseExceptionInternal)ex).DatabaseName = databaseName;
                }
            }
            if (ex != null)
            {
                throw ex;
            }
        }
Exemplo n.º 4
0
        // Token: 0x0600081C RID: 2076 RVA: 0x00027534 File Offset: 0x00025734
        internal static void ThrowDbActionWrapperExceptionIfNecessary(Exception exception)
        {
            if (exception == null)
            {
                return;
            }
            string dbActionError         = string.Empty;
            IHaRpcServerBaseException ex = exception as IHaRpcServerBaseException;

            if (ex != null)
            {
                dbActionError = ex.ErrorMessage;
            }
            else
            {
                dbActionError = exception.Message;
            }
            if (exception is TransientException)
            {
                throw new AmDbActionWrapperTransientException(dbActionError, exception);
            }
            throw new AmDbActionWrapperException(dbActionError, exception);
        }
Exemplo n.º 5
0
        public static void ThrowDbOperationWrapperExceptionIfNecessary(Exception exception)
        {
            if (exception == null)
            {
                return;
            }
            string operationError        = string.Empty;
            IHaRpcServerBaseException ex = exception as IHaRpcServerBaseException;

            if (ex != null)
            {
                operationError = ex.ErrorMessage;
            }
            else
            {
                operationError = exception.Message;
            }
            if (exception is TransientException)
            {
                throw new ReplayDbOperationWrapperTransientException(operationError, exception);
            }
            throw new ReplayDbOperationWrapperException(operationError, exception);
        }