[Modify] Throw exceptions
This commit is contained in:
parent
8a095213f6
commit
49d17cfa7b
@ -162,8 +162,19 @@ namespace WebSocketSharp.Server
|
|||||||
/// </param>
|
/// </param>
|
||||||
public IWebSocketSession this[string id] {
|
public IWebSocketSession this[string id] {
|
||||||
get {
|
get {
|
||||||
|
if (_state != ServerState.Start) {
|
||||||
|
var msg = "The current state of the manager is not Start.";
|
||||||
|
throw new InvalidOperationException (msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (id == null)
|
||||||
|
throw new ArgumentNullException ("id");
|
||||||
|
|
||||||
|
if (id.Length == 0)
|
||||||
|
throw new ArgumentException ("An empty string.", "id");
|
||||||
|
|
||||||
IWebSocketSession session;
|
IWebSocketSession session;
|
||||||
TryGetSession (id, out session);
|
tryGetSession (id, out session);
|
||||||
|
|
||||||
return session;
|
return session;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user