Class WireFormatException
Thrown when bytes received from the other side do not form a valid message. It carries the close code the connection is closed with, so the transport never has to classify a decoding failure itself.
public sealed class WireFormatException : Exception, ISerializable
- Inheritance
-
WireFormatException
- Implements
- Inherited Members
Remarks
Only a decoder throws this, and only for input it received. An encoder handed values it cannot represent throws ArgumentException instead: that is a bug on the sending side, not a hostile or broken peer.
Constructors
WireFormatException(ushort, string)
Creates the exception.
public WireFormatException(ushort closeCode, string message)
Parameters
closeCodeushortThe close code the connection must be closed with (see CloseCodes).
messagestringWhat was wrong with the input.
Properties
CloseCode
The close code the connection must be closed with: 1002 for framing, 1007 for a malformed payload, 1009 for an oversized message.
public ushort CloseCode { get; }