Exemple #1
0
        private void DisplayError(MixERPException ex)
        {
            this.messageLabel.CssClass = this.GetErrorCssClass();
            this.messageLabel.ID       = "ScrudError";

            string message = ex.Message;

            if (!string.IsNullOrWhiteSpace(ex.DBConstraintName))
            {
                string fullyQualifiedResourceClassName = this.ResourceAssembly.GetName().Name + ".Resources." + this.GetResourceClassName();
                message = LocalizationHelper.GetResourceString(this.ResourceAssembly, fullyQualifiedResourceClassName, ex.DBConstraintName);
            }

            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();
        }
        private void Application_Error(object sender, EventArgs e)
        {
            Exception ex = this.Server.GetLastError();

            if (ex == null)
            {
                return;
            }

            if (ex is ThreadAbortException)
            {
                Log.Verbose("The thread was being aborted. {Exception}.", ex);
                return;
            }


            MixERPException exception = ex as MixERPException;

            if (exception != null)
            {
                Log.Verbose("Handling exception.");

                MixERPExceptionManager.HandleException(exception);
                return;
            }

            Log.Error("Exception occurred. {Exception}.", ex);

            if (ex.InnerException != null)
            {
                Log.Error("Inner Exception. {InnerException}.", ex.InnerException);
            }

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

            return(ex.Message);
        }
Exemple #4
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);
            }
        }
Exemple #5
0
        internal static void Handle(Exception ex)
        {
            if (ex == null)
            {
                return;
            }

            if (ex is ThreadAbortException)
            {
                Log.Verbose("The thread was being aborted. {Exception}.", ex);
                return;
            }


            MixERPException exception = ex as MixERPException;

            if (exception != null)
            {
                Log.Verbose("Handling exception.");

                MixERPException.Handle(exception);
                return;
            }

            Log.Error("Exception occurred. {Exception}.", ex);

            var innerException = ex.InnerException as MixERPException;

            if (innerException != null)
            {
                MixERPException.Handle(innerException);
                return;
            }

            if (ex.InnerException != null)
            {
                Log.Error("Inner Exception. {InnerException}.", ex.InnerException);
            }

p:
            throw ex;
        }
Exemple #6
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();
        }
Exemple #7
0
        private string GetLocalizedErrorMessage(MixERPException ex)
        {
            string fullyQualifiedResourceClassName = this.ResourceAssembly.GetName().Name + ".Resources." + this.GetResourceClassName();

            return(LocalizationHelper.GetResourceString(this.ResourceAssembly, fullyQualifiedResourceClassName, ex.DBConstraintName));
        }