Example #1
0
        private string GetLocalizedErrorMessage(MixERPException ex)
        {
            try
            {
                return i18n.ResourceManager.GetString(this.GetResourceClassName(), ex.DBConstraintName);
            }
            catch (MissingManifestResourceException)
            {
                //swallow
            }

            return ex.Message;
        }
Example #2
0
        public static void HandleException(MixERPException ex)
        {
            if (ex == null)
            {
                return;
            }

            if (HttpContext.Current.Session != null)
            {
                HttpContext.Current.Session["ex"] = ex;
                Log.Information("Exception object was added to session.");

                HttpContext.Current.Server.TransferRequest("~/Site/RuntimeError.aspx", true);
            }
        }
Example #3
0
        private void DisplayError(MixERPException ex)
        {
            this.messageLabel.CssClass = this.GetErrorCssClass();
            this.messageLabel.ID = "ScrudError";

            string message = ex.Message;

            if (!string.IsNullOrWhiteSpace(ex.DBConstraintName))
            {
                message = this.GetLocalizedErrorMessage(ex);
            }

            this.messageLabel.Text = message;
            this.messageLabel.Style.Add("display", "block");
            this.messageLabel.Style.Add("font-size", "16px;");
            this.messageLabel.Style.Add("padding", "8px 0;");

            this.gridPanel.Attributes["style"] = "display:block;";
            this.formPanel.Attributes["style"] = "display:none;";

            Log.Warning("ScrudFactory: {Message}/{Exception}.", message, ex);

            this.ResetForm();
        }