private void OnRaiseConnectedEvent(NetConnection connection)
{
if (OnConnection == null) return;
List<Exception> exceptions = null;
var handlers = OnConnection.GetInvocationList();
foreach (OnConnectedHandler handler in handlers)
{
try
{
handler((NetNode)connection);
}
catch (Exception e)
{
if (exceptions == null)
{
exceptions = new List<Exception>();
}
exceptions.Add(e);
//TODO: log error maybe fail after all called.
}
}
if (exceptions != null)
{
throw new AggregateException("handler error", exceptions);
}
return;
}