[Modify] Throw exceptions
This commit is contained in:
parent
c03131a5db
commit
09fd6ca410
@ -264,11 +264,18 @@ namespace WebSocketSharp.Server
|
|||||||
}
|
}
|
||||||
|
|
||||||
set {
|
set {
|
||||||
if (State != WebSocketState.Connecting)
|
if (State != WebSocketState.Connecting) {
|
||||||
return;
|
var msg = "The session has already started.";
|
||||||
|
throw new InvalidOperationException (msg);
|
||||||
|
}
|
||||||
|
|
||||||
if (value != null && (value.Length == 0 || !value.IsToken ()))
|
if (value == null || value.Length == 0) {
|
||||||
|
_protocol = null;
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!value.IsToken ())
|
||||||
|
throw new ArgumentException ("Not a token.", "value");
|
||||||
|
|
||||||
_protocol = value;
|
_protocol = value;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user