Beispiel #1
0
        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);
            }
        }
Beispiel #2
0
 internal PcapException(string msg, PcapError error)
     : base(msg + $" (Error Code: {error})")
 {
     Error = error;
 }
Beispiel #3
0
 internal PcapException() : base()
 {
     Error = PcapError.Generic;
 }
Beispiel #4
0
 internal PcapException(string msg)
     : base(msg)
 {
     Error = PcapError.Generic;
 }
Beispiel #5
0
 internal PcapException(string msg, PcapError error = PcapError.Generic) : base(msg)
 {
     Error = error;
 }