Exemplo n.º 1
0
        private void HandlePaymentPersistException(PXOuterException exception)
        {
            var message = $"{exception.Message} {exception.InnerMessages.First()}";

            InvoiceEntry.Document.Cache.RaiseException <APInvoiceJCExt.amountToPay>(InvoiceEntry.Document.Current,
                                                                                    message, InvoiceExtension.AmountToPay);
            throw new PXException();
        }
Exemplo n.º 2
0
        public string CreateErrorMessage(bool detailed, string text, string message, Exception error, string[] details)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine(text);
            if (message != null)
            {
                sb.AppendLine(message);
            }

            if (error != null)
            {
                var errorText = error.ToString();

                errorText = PXExchangeServer.MapErrors(errorText);

                sb.AppendLine(detailed ? errorText : error.Message);
            }

            if (details != null)
            {
                sb.AppendLine();
                foreach (string str in details)
                {
                    sb.AppendLine(str);
                }
            }
            if (error is PXOuterException)
            {
                PXOuterException outer = error as PXOuterException;
                foreach (string inner in outer.InnerMessages)
                {
                    sb.AppendLine(inner);
                }
            }

            return(sb.ToString());
        }
        private static PXOuterException GetPXOuterExceptionWithContextMessage(string contextMessage, PXOuterException ex)
        {
            Dictionary <string, string> innerExceptions = new Dictionary <string, string>();

            for (int i = 0; i < ex.InnerFields.Length; i++)
            {
                innerExceptions.Add(ex.InnerFields[i], ex.InnerMessages[i]);
            }

            return(new PXOuterException(innerExceptions, ex.GraphType, ex.Row, contextMessage + Environment.NewLine + ex.Message));
        }