Ejemplo n.º 1
0
        public static string BuildErrorMessage(string Message, Exception ex, bool showTrace, UserError ue)
        {
            StringBuilder MessBuilder = new StringBuilder();

               string CustId = null;
            WPSProcessException pex = ex as WPSProcessException;
            if (pex != null && pex.Error != null)
            CustId = pex.Error.CustomerID;

            if (!string.IsNullOrEmpty(Message))
            {
            MessBuilder.Append(Message);
            MessBuilder.Append(" - ");
            }

            if (!string.IsNullOrEmpty(CustId))
            {
            MessBuilder.Append(" CustomerId: ");
            MessBuilder.Append(CustId);
            MessBuilder.Append(" - ");
            }
            MessBuilder.Append("Exception: ");
            MessBuilder.Append(Message);
            MessBuilder.AppendLine(ex.Message);
            Exception inerex = ex;
            while (inerex.InnerException != null)
            {
            inerex = inerex.InnerException;
            MessBuilder.AppendLine(inerex.Message);

            }
            if (showTrace)
            MessBuilder.Append(ex.StackTrace);
            return MessBuilder.ToString();
        }
Ejemplo n.º 2
0
        public UserError InstanceMapError(string ErrorCode, string[] pars)
        {
            UserError rez = new UserError();
            rez.errorCode = ErrorCode;
            if (Mapping.ContainsKey(ErrorCode))
            {
                rez.errorMessage = String.Format(Mapping[ErrorCode].errorMessage, pars);
                rez.isUserError = Mapping[ErrorCode].isUserError;
            }

            return rez;
        }