Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
Exception.cs
1using System.Text;
2using System.Xml;
4
6{
10 public class Exception : ProfilerEvent
11 {
12 private readonly System.Exception exception;
13 private readonly string label;
14 private int ordinal;
15
22 public Exception(long Ticks, System.Exception Exception, ProfilerThread Thread)
23 : this(Ticks, Exception, string.Empty, Thread)
24 {
25 }
26
34 public Exception(long Ticks, System.Exception Exception, string Label, ProfilerThread Thread)
35 : base(Ticks, Thread)
36 {
37 this.exception = Exception;
38 this.label = Label;
39 }
40
44 public System.Exception ExceptionObject => this.exception;
45
49 public string Label => this.label;
50
52 public override string EventType => "Exception";
53
55 public override void ExportXmlAttributes(XmlWriter Output, ProfilerEvent Previous, TimeUnit TimeUnit)
56 {
57 Output.WriteAttributeString("type", this.exception.GetType().FullName);
58 Output.WriteAttributeString("messsage", this.exception.Message);
59
60 if (!string.IsNullOrEmpty(this.label))
61 Output.WriteAttributeString("label", this.label);
62
63 base.ExportXmlAttributes(Output, Previous, TimeUnit);
64
65 Output.WriteElementString("StackTrace", this.exception.StackTrace);
66 }
67
69 public override void ExportPlantUml(PlantUmlStates States)
70 {
71 StringBuilder Output = States.GetBuilder(this.Ticks);
72
73 Output.Append('X');
74 Output.Append(this.ordinal.ToString());
75 Output.Append(" -> ");
76 Output.Append(this.Thread.Key);
77
78 if (!string.IsNullOrEmpty(this.label))
79 {
80 Output.Append(" : \"");
81 Output.Append(this.label.Replace('"', '\''));
82 Output.Append('"');
83 }
84
85 Output.AppendLine();
86 }
87
89 public override string PlantUmlState => string.Empty;
90
92 public override void ExportPlantUmlPreparation()
93 {
94 this.ordinal = this.Thread.Profiler.GetExceptionOrdinal(this.exception);
95 }
96 }
97}
System.Exception ExceptionObject
Exception object.
Definition: Exception.cs:44
override void ExportPlantUmlPreparation()
Prepares the event for export to PlantUML
Definition: Exception.cs:92
Exception(long Ticks, System.Exception Exception, string Label, ProfilerThread Thread)
Exception occurred
Definition: Exception.cs:34
override void ExportXmlAttributes(XmlWriter Output, ProfilerEvent Previous, TimeUnit TimeUnit)
Exports event attributes to XML.
Definition: Exception.cs:55
Exception(long Ticks, System.Exception Exception, ProfilerThread Thread)
Exception occurred
Definition: Exception.cs:22
override void ExportPlantUml(PlantUmlStates States)
Exports events to PlantUML.
Definition: Exception.cs:69
Abstract base class for profiler events.
ProfilerThread Thread
Profiler thread generating the event.
Contains internal states used during generation of PlantUML diagram.s
StringBuilder GetBuilder(long Ticks)
Gets the PlantUML output StringBuilder associated with a time-point.
int GetExceptionOrdinal(System.Exception Exception)
Gets the ordinal for a type of exception.
Definition: Profiler.cs:668
Class that keeps track of events and timing for one thread.
Profiler Profiler
Profiler reference.
string Key
Thread key in diagrams.
TimeUnit
Options for presenting time in reports.
Definition: Profiler.cs:16