Наследование: System.Exception
Пример #1
0
        public Channel Subscribe(string channelName)
        {
            if (_connection.State != ConnectionState.Connected)
            {
                var pusherException = new PusherException("You must wait for Pusher to connect before you can subscribe to a channel", ErrorCodes.NotConnected);
                RaiseError(pusherException);
                throw pusherException;
            }

            if (Channels.ContainsKey(channelName))
            {
                Trace.TraceEvent(TraceEventType.Warning, 0, "Channel '" + channelName + "' is already subscribed to. Subscription event has been ignored.");
                return(Channels[channelName]);
            }

            // If private or presence channel, check that auth endpoint has been set
            var chanType = ChannelTypes.Public;

            if (channelName.ToLower().StartsWith("private-"))
            {
                chanType = ChannelTypes.Private;
            }
            else if (channelName.ToLower().StartsWith("presence-"))
            {
                chanType = ChannelTypes.Presence;
            }

            return(SubscribeToChannel(chanType, channelName));
        }
 private void InvokeErrorHandler(PusherException error)
 {
     try
     {
         if (Error != null)
         {
             if (!error.EmittedToErrorHandler)
             {
                 try
                 {
                     Error.Invoke(this, error);
                 }
                 catch (Exception e)
                 {
                     if (Options.TraceLogger != null)
                     {
                         Options.TraceLogger.TraceError($"Error caught invoking delegate Pusher.Error:{Environment.NewLine}{e}");
                     }
                 }
             }
         }
     }
     finally
     {
         error.EmittedToErrorHandler = true;
     }
 }
Пример #3
0
 private void RaiseError(PusherException error)
 {
     _currentError = error;
     _pusher.ErrorOccured(error);
     if (_connectionSemaphore != null)
     {
         _connectionSemaphore.Release();
     }
 }
Пример #4
0
 private void AuthEndpointCheck()
 {
     if (_options.Authorizer == null)
     {
         var pusherException = new PusherException("You must set a ChannelAuthorizer property to use private or presence channels", ErrorCodes.ChannelAuthorizerNotSet);
         RaiseError(pusherException);
         throw pusherException;
     }
 }
Пример #5
0
        private void RaiseError(PusherException error)
        {
            var handler = _errorEvent;

            if (handler != null)
            {
                handler(this, error);
            }
        }
Пример #6
0
        private void RaiseError(PusherException error)
        {
            var handler = Error;

            if (handler != null)
            {
                handler(this, error);
            }
            //else
            //    Pusher.Trace.TraceEvent(TraceEventType.Error, 0, error.ToString());
        }
Пример #7
0
        private void HandleException(Exception e, string eventName, TData data)
        {
            if (ErrorHandler != null)
            {
                PusherException errorToHandle = e as PusherException;
                if (errorToHandle == null)
                {
                    errorToHandle = new EventEmitterActionException <TData>(ErrorCodes.EventEmitterActionError, eventName, data, e);
                }

                ErrorHandler.Invoke(errorToHandle);
            }
        }
Пример #8
0
        private void RaiseError(PusherException error)
        {
            // if a handler is registerd, use it, otherwise throw
            var handler = Error;

            if (handler != null)
            {
                handler(this, error);
            }
            else
            {
                throw error;
            }
        }
Пример #9
0
        private void RaiseError(PusherException error)
        {
            // if a handler is registerd, use it, otherwise just trace. No code can catch exception here if thrown.
            var handler = Error;

            if (handler != null)
            {
                handler(this, error);
            }
            else
            {
                Pusher.Trace.TraceEvent(TraceEventType.Error, 0, error.ToString());
            }
        }
 private void RaiseError(PusherException error, bool runAsNewTask = true)
 {
     if (Error != null)
     {
         if (!error.EmittedToErrorHandler)
         {
             if (runAsNewTask)
             {
                 Task.Run(() =>
                 {
                     InvokeErrorHandler(error);
                 });
             }
             else
             {
                 InvokeErrorHandler(error);
             }
         }
     }
     else
     {
         error.EmittedToErrorHandler = true;
     }
 }
 private void RaiseError(PusherException error)
 {
     // if a handler is registerd, use it, otherwise throw
     var handler = Error;
     if (handler != null) handler(this, error);
     else throw error;
 }
Пример #12
0
 void IPusher.ErrorOccured(PusherException pusherException)
 {
     RaiseError(pusherException);
 }
 private void RaiseError(PusherException error)
 {
     var handler = _errorEvent;
     if (handler != null) handler(this, error);
 }
 void ITriggerChannels.RaiseChannelError(PusherException error)
 {
     RaiseError(error, runAsNewTask: false);
 }
 private void AuthEndpointCheck()
 {
     if (_options.Authorizer == null)
     {
         var pusherException = new PusherException("You must set a ChannelAuthorizer property to use private or presence channels", ErrorCodes.ChannelAuthorizerNotSet);
         RaiseError(pusherException);
         throw pusherException;
     }
 }
Пример #16
0
 private void PusherError(object sender, PusherException error)
 {
     // todo handle
     ((Subject<Channel>)UserChannel).OnNext(null);
     _logger.Error(error, "Pusher error: {0}", error.Message);
 }
 static void _pusher_Error(object sender, PusherException error)
 {
     Console.WriteLine("Pusher Error: " + error.ToString());
 }
Пример #18
0
 private void RaiseError(PusherException error)
 {
     _pusher.ErrorOccured(error);
 }
Пример #19
0
 private void Error(object sender, PusherException e)
 {
 }