Changeset 413 for trunk/sources/HeuristicLab.Grid/ProcessingEngine.cs
- Timestamp:
- 07/31/08 10:07:09 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Grid/ProcessingEngine.cs
r412 r413 36 36 } 37 37 38 private string errorMessage; 39 public string ErrorMessage { 40 get { return errorMessage; } 41 } 42 38 43 public ProcessingEngine() 39 44 : base() { … … 51 56 canceledAttr.Value = Canceled.ToString(); 52 57 node.Attributes.Append(canceledAttr); 58 if(errorMessage != null) { 59 XmlAttribute errorMessageAttr = document.CreateAttribute("ErrorMessage"); 60 errorMessageAttr.Value = ErrorMessage; 61 node.Attributes.Append(errorMessageAttr); 62 } 53 63 node.AppendChild(PersistenceManager.Persist("InitialOperation", initialOperation, document, persistedObjects)); 54 64 return node; … … 58 68 base.Populate(node, restoredObjects); 59 69 myCanceled = bool.Parse(node.Attributes["Canceled"].Value); 70 if(node.Attributes["ErrorMessage"] != null) errorMessage = node.Attributes["ErrorMessage"].Value; 60 71 initialOperation = (AtomicOperation)PersistenceManager.Restore(node.SelectSingleNode("InitialOperation"), restoredObjects); 61 72 } … … 69 80 next = atomicOperation.Operator.Execute(atomicOperation.Scope); 70 81 } catch(Exception ex) { 71 Trace.TraceWarning("Exception while executing an engine.\n" + ex.Message + "\n" + ex.StackTrace); 82 errorMessage = CreateErrorMessage(ex); 83 Trace.TraceWarning(errorMessage); 72 84 // push operation on stack again 73 85 myExecutionStack.Push(atomicOperation); … … 83 95 } 84 96 } 97 98 private string CreateErrorMessage(Exception ex) { 99 StringBuilder sb = new StringBuilder(); 100 sb.Append("Sorry, but something went wrong!\n\n" + ex.Message + "\n\n" + ex.StackTrace); 101 102 while(ex.InnerException != null) { 103 ex = ex.InnerException; 104 sb.Append("\n\n-----\n\n" + ex.Message + "\n\n" + ex.StackTrace); 105 } 106 return sb.ToString(); 107 } 85 108 } 86 109 }
Note: See TracChangeset
for help on using the changeset viewer.