IKVM11  11
Java SE 11 Virtual Machine for .NET
Loading...
Searching...
No Matches
DiagnosticEventException.cs
Go to the documentation of this file.
1using System;
2
4{
5
6 sealed class DiagnosticEventException : Exception
7 {
8
15 static string FormatDiagnosticLevel(DiagnosticLevel level)
16 {
17 return level switch
18 {
19 DiagnosticLevel.Trace => "trace",
20 DiagnosticLevel.Info => "info",
21 DiagnosticLevel.Warning => "warning",
22 DiagnosticLevel.Error => "error",
23 DiagnosticLevel.Fatal => "fatal",
24 _ => throw new InvalidOperationException(),
25 };
26 }
27
28 readonly DiagnosticEvent _event;
29
35#if NET8_0_OR_GREATER
36 base($"{FormatDiagnosticLevel(evt.Diagnostic.Level)} IKVM{evt.Diagnostic.Id:D4}: {string.Format(null, evt.Diagnostic.Message, evt.Args)}")
37#else
38 base($"{FormatDiagnosticLevel(evt.Diagnostic.Level)} IKVM{evt.Diagnostic.Id:D4}: {string.Format(null, evt.Diagnostic.Message, evt.Args)}")
39#endif
40 {
41 _event = evt;
42 }
43
47 public DiagnosticEvent Event => _event;
48
49 }
50
51}
DiagnosticEvent Event
Gets the event that triggered this exception.
DiagnosticLevel
Represents the level of security of a diagnostic event.