Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/09/10 01:15:16 (14 years ago)
Author:
swagner
Message:

Implemented logs of engines (#963).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Core.Views/3.3/Auxiliary.cs

    r2916 r3289  
    2323using System.Text;
    2424using System.Windows.Forms;
     25using HeuristicLab.Core;
    2526
    2627namespace HeuristicLab.Core.Views {
     
    4546    /// <param name="ex">The exception to display.</param>
    4647    public static void ShowErrorMessageBox(Exception ex) {
    47       MessageBox.Show(BuildErrorMessage(ex),
     48      MessageBox.Show(Log.BuildErrorMessage(ex),
    4849                      "Error - " + ex.GetType().Name,
    4950                      MessageBoxButtons.OK,
    5051                      MessageBoxIcon.Error);
    5152    }
    52     /// <summary>
    53     /// Builds an error message out of an exception and formats it accordingly.
    54     /// </summary>
    55     /// <param name="ex">The exception to format.</param>
    56     /// <returns>The formated message.</returns>
    57     public static string BuildErrorMessage(Exception ex) {
    58       string nl = Environment.NewLine;
    59       StringBuilder sb = new StringBuilder();
    60       sb.Append("Sorry, but something went wrong!" + nl + ex.Message + nl + ex.StackTrace);
    61 
    62       while (ex.InnerException != null) {
    63         ex = ex.InnerException;
    64         sb.Append(nl + "-----" + nl + ex.Message + nl + ex.StackTrace);
    65       }
    66       return sb.ToString();
    67     }
    6853    #endregion
    6954  }
Note: See TracChangeset for help on using the changeset viewer.