using Newtonsoft.Json.Linq; namespace RhythmBase.Exceptions { /// /// Represents errors that occur during converting operations. /// public class ConvertingException : RhythmBaseException { #pragma warning disable IDE0052 // 删除未读的私有成员 private readonly JToken? _convertingEvent; #pragma warning restore IDE0052 // 删除未读的私有成员 /// /// Initializes a new instance of the class with a specified inner exception. /// /// The exception that is the cause of the current exception. public ConvertingException(Exception innerException) : base("An exception was thrown on reading the level.", innerException) { } /// /// Initializes a new instance of the class with a specified error message. /// /// The message that describes the error. public ConvertingException(string message) : base(string.Format("An exception was thrown on reading the event: {0}", message)) { } /// /// Initializes a new instance of the class with a specified event and inner exception. /// /// The event that caused the exception. /// The exception that is the cause of the current exception. public ConvertingException(JToken @event, Exception innerException) : base($"An exception was thrown on reading the event. \"{innerException}\"") { _convertingEvent = @event; } /// /// Initializes a new instance of the class with a specified event and inner exception. /// /// The event that caused the exception. /// The exception that is the cause of the current exception. public ConvertingException(JToken @event, string message) : base($"An exception was thrown on reading the event: {message}") { _convertingEvent = @event; } } }