[Modify] Polish it

This commit is contained in:
sta 2019-10-28 21:37:13 +09:00
parent 49777b1ac6
commit 4334483561

View File

@ -488,10 +488,18 @@ namespace WebSocketSharp.Net
} }
set { set {
checkDisposedOrHeadersSent (); if (_disposed)
if (value < 100 || value > 999) throw new ObjectDisposedException (GetType ().ToString ());
throw new System.Net.ProtocolViolationException (
"A value isn't between 100 and 999 inclusive."); if (_headersSent) {
var msg = "The response is already being sent.";
throw new InvalidOperationException (msg);
}
if (value < 100 || value > 999) {
var msg = "A value is not between 100 and 999 inclusive.";
throw new System.Net.ProtocolViolationException (msg);
}
_statusCode = value; _statusCode = value;
_statusDescription = value.GetStatusDescription (); _statusDescription = value.GetStatusDescription ();