/// <summary> /// metodo que resuelve el msg a mostrar para ex no manejadas /// </summary> /// <param name="o"></param> public static void HandleUnhandledException(Object o) { string wError=String.Empty; ExceptionViewComponent wExceptionViewer = new ExceptionViewComponent(); wExceptionViewer.ButtonsYesNoVisible = DevExpress.XtraBars.BarItemVisibility.Always; wExceptionViewer.Title = "Error no manejado"; Exception wException = o as Exception; if (wException != null) { wExceptionViewer.Title = wException.Source; if (wException.GetType().IsAssignableFrom(typeof(TechnicalException))) { wError = wException.Message; } if (wException.GetType().IsAssignableFrom(typeof(FunctionalException))) wError = wException.Message; if (String.IsNullOrEmpty(wError)) wError = Fwk.Exceptions.ExceptionHelper.GetAllMessageException(wException); } else wError = o.ToString(); System.Text.StringBuilder wStringBuilder = new System.Text.StringBuilder(5000); //wStringBuilder.Append(@"Se detectaron anomalías en la aplicacion por favor chequee los siguientes errores: "); //wStringBuilder.Append(Environment.NewLine); //wStringBuilder.Append(Environment.NewLine); wStringBuilder.Append(@"{0}"); wStringBuilder.Append(Environment.NewLine); wStringBuilder.Append("¿Desea salir de la aplicación?"); wError = string.Format(wStringBuilder.ToString(), wError); #region Log del error en la base de datos o dicha configuracion //bool wLogError = logError; //if (logError) //{ // //Si el error es del propio frqmework de logging no intentar loguear y evitaar asi la recursividad del error // if (Fwk.Exceptions.ExceptionHelper.GetFwkExceptionTypes(wException) == Fwk.Exceptions.FwkExceptionTypes.TechnicalException) // if (((Fwk.Exceptions.TechnicalException)wException).ErrorId == "9004") // wLogError = false; //} #endregion DialogResult wResult = wExceptionViewer.Show(wExceptionViewer.Title, wError, string.Empty, false); if (wResult == DialogResult.OK) Application.Exit(); }
/// <summary> /// metodo que resuelve el msg a mostrar para ex no manejadas /// </summary> /// <param name="o"></param> public static void HandleUnhandledException(Object o) { string wError = String.Empty; ExceptionViewComponent wExceptionViewer = new ExceptionViewComponent(); wExceptionViewer.ButtonsYesNoVisible = DevExpress.XtraBars.BarItemVisibility.Always; wExceptionViewer.Title = "Error no manejado"; Exception wException = o as Exception; if (wException != null) { wExceptionViewer.Title = wException.Source; if (wException.GetType().IsAssignableFrom(typeof(TechnicalException))) { wError = wException.Message; } if (wException.GetType().IsAssignableFrom(typeof(FunctionalException))) { wError = wException.Message; } if (String.IsNullOrEmpty(wError)) { wError = Fwk.Exceptions.ExceptionHelper.GetAllMessageException(wException); } } else { wError = o.ToString(); } System.Text.StringBuilder wStringBuilder = new System.Text.StringBuilder(5000); //wStringBuilder.Append(@"Se detectaron anomalías en la aplicacion por favor chequee los siguientes errores: "); //wStringBuilder.Append(Environment.NewLine); //wStringBuilder.Append(Environment.NewLine); wStringBuilder.Append(@"{0}"); wStringBuilder.Append(Environment.NewLine); wStringBuilder.Append("¿Desea salir de la aplicación?"); wError = string.Format(wStringBuilder.ToString(), wError); #region Log del error en la base de datos o dicha configuracion //bool wLogError = logError; //if (logError) //{ // //Si el error es del propio frqmework de logging no intentar loguear y evitaar asi la recursividad del error // if (Fwk.Exceptions.ExceptionHelper.GetFwkExceptionTypes(wException) == Fwk.Exceptions.FwkExceptionTypes.TechnicalException) // if (((Fwk.Exceptions.TechnicalException)wException).ErrorId == "9004") // wLogError = false; //} #endregion DialogResult wResult = wExceptionViewer.Show(wExceptionViewer.Title, wError, string.Empty, false); if (wResult == DialogResult.OK) { Application.Exit(); } }