internal void RaiseConfigurationFailed(string property, PcapError error, string message) { message = message ?? $"Failed to set {property}."; if (ConfigurationFailed is null) { var exception = error == PcapError.PlatformNotSupported ? (Exception) new PlatformNotSupportedException() : new PcapException(message, error); throw exception; } else { var args = new ConfigurationFailedEventArgs { Property = property, Error = error, Message = message, }; ConfigurationFailed.Invoke(this, args); } }
internal PcapException(string msg, PcapError error) : base(msg + $" (Error Code: {error})") { Error = error; }
internal PcapException() : base() { Error = PcapError.Generic; }
internal PcapException(string msg) : base(msg) { Error = PcapError.Generic; }
internal PcapException(string msg, PcapError error = PcapError.Generic) : base(msg) { Error = error; }