[Modify] Throw exceptions
This commit is contained in:
parent
174d3ff00e
commit
51663793c1
@ -1052,14 +1052,17 @@ namespace WebSocketSharp.Server
|
||||
/// </param>
|
||||
public bool TryGetSession (string id, out IWebSocketSession session)
|
||||
{
|
||||
var msg = _state.CheckIfAvailable (false, true, false) ?? id.CheckIfValidSessionID ();
|
||||
if (msg != null) {
|
||||
_logger.Error (msg);
|
||||
session = null;
|
||||
|
||||
return false;
|
||||
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");
|
||||
|
||||
return tryGetSession (id, out session);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user