[Modify] Polish it

This commit is contained in:
sta 2019-10-24 20:27:12 +09:00
parent 53aaee912c
commit 397e7dabbf

View File

@ -349,12 +349,26 @@ namespace WebSocketSharp.Net
} }
set { set {
checkDisposedOrHeadersSent (); if (_disposed)
throw new ObjectDisposedException (GetType ().ToString ());
if (_headersSent) {
var msg = "The response is already being sent.";
throw new InvalidOperationException (msg);
}
if (value == null) if (value == null)
throw new ArgumentNullException ("value"); throw new ArgumentNullException ("value");
if (value.Major != 1 || (value.Minor != 0 && value.Minor != 1)) if (value.Major != 1) {
throw new ArgumentException ("Not 1.0 or 1.1.", "value"); var msg = "Its Major property is not 1.";
throw new ArgumentException (msg, "value");
}
if (value.Minor < 0 || value.Minor > 1) {
var msg = "Its Minor property is not 0 or 1.";
throw new ArgumentException (msg, "value");
}
_version = value; _version = value;
} }