Ejemplo n.º 1
0
 public PubnubClientError(int statusCode, PubnubErrorSeverity errorSeverity, string message,
                          PubnubMessageSource source, PubnubWebRequest pubnubWebRequest, PubnubWebResponse pubnubWebResponse, string description,
                          string channels, string channelGroups)
     : this(statusCode, errorSeverity, false, message, null, source, pubnubWebRequest, pubnubWebResponse, description
            , channels, channelGroups)
 {
 }
Ejemplo n.º 2
0
 internal static void FireErrorCallbacksForAllChannels <T> (Exception ex, RequestState <T> requestState,
                                                            PubnubErrorSeverity severity, PubnubErrorCode errorType,
                                                            PubnubErrorFilter.Level errorLevel)
 {
     FireErrorCallbacksForAllChannelsCommon <T> (ex, "", requestState, requestState.ChannelEntities, severity,
                                                 errorType, requestState.RespType, errorLevel
                                                 );
 }
Ejemplo n.º 3
0
 public PubnubClientError(int statusCode, PubnubErrorSeverity errorSeverity, bool isDotNetException, string message,
                          Exception detailedDotNetException, PubnubMessageSource source, PubnubWebRequest pubnubWebRequest,
                          PubnubWebResponse pubnubWebResponse, string description, List <ChannelEntity> channelEntitles)
     : this(statusCode, errorSeverity, isDotNetException, message, detailedDotNetException, source, pubnubWebRequest,
            pubnubWebResponse, description, Helpers.GetNamesFromChannelEntities(channelEntitles, false),
            Helpers.GetNamesFromChannelEntities(channelEntitles, true))
 {
 }
Ejemplo n.º 4
0
 internal static void FireErrorCallbacksForAllChannels <T> (string message, RequestState <T> requestState,
                                                            PubnubErrorSeverity severity, PubnubErrorCode errorType,
                                                            PubnubErrorFilter.Level errorLevel)
 {
     FireErrorCallbacksForAllChannelsCommon <T> (null, message, requestState, requestState.ChannelEntities, severity,
                                                 errorType, requestState.RespType, errorLevel
                                                 );
 }
Ejemplo n.º 5
0
 internal static void FireErrorCallbacksForAllChannels <T> (WebException webEx, RequestState <T> requestState,
                                                            PubnubErrorSeverity severity, PubnubErrorFilter.Level errorLevel)
 {
     foreach (ChannelEntity channelEntity in requestState.ChannelEntities)
     {
         PubnubClientError error = Helpers.CreatePubnubClientError <T> (webEx, requestState, channelEntity.ChannelID.ChannelOrChannelGroupName,
                                                                        severity);
         FireErrorCallback <T> (channelEntity,
                                errorLevel, error);
     }
 }
Ejemplo n.º 6
0
 public PubnubClientError(int statusCode, PubnubErrorSeverity errorSeverity, string message, PubnubMessageSource source, PubnubWebRequest pubnubWebRequest, PubnubWebResponse pubnubWebResponse, string description, string channel)
 {
     _dateTimeGMT             = DateTime.Now.ToUniversalTime();
     _statusCode              = statusCode;
     _isDotNetException       = false;
     _message                 = message;
     _errorSeverity           = errorSeverity;
     _messageSource           = source;
     _channel                 = channel;
     _detailedDotNetException = null;
     _pubnubWebRequest        = pubnubWebRequest;
     _pubnubWebResponse       = pubnubWebResponse;
     _description             = description;
 }
Ejemplo n.º 7
0
        internal static void FireErrorCallbacksForAllChannels <T> (WebException webEx, RequestState <T> requestState,
                                                                   PubnubErrorSeverity severity, SafeDictionary <PubnubChannelCallbackKey,
                                                                                                                 object> channelCallbacks, bool callbackObjectType, PubnubErrorFilter.Level errorLevel)
        {
            for (int index = 0; index < requestState.Channels.Length; index++)
            {
                string            activeChannel = requestState.Channels [index].ToString();
                PubnubClientError error         = Helpers.CreatePubnubClientError <T> (webEx, requestState, activeChannel,
                                                                                       severity);

                FireErrorCallback <T> (activeChannel, channelCallbacks,
                                       callbackObjectType, requestState.RespType, errorLevel, error);
            }
        }
Ejemplo n.º 8
0
        internal static void FireErrorCallbacksForAllChannels <T> (string message, RequestState <T> requestState, string[] channels,
                                                                   PubnubErrorSeverity severity, SafeDictionary <PubnubChannelCallbackKey,
                                                                                                                 object> channelCallbacks, bool callbackObjectType, PubnubErrorCode errorType,
                                                                   ResponseType responseType, PubnubErrorFilter.Level errorLevel)
        {
            for (int index = 0; index < channels.Length; index++)
            {
                string            activeChannel = channels [index].ToString();
                PubnubClientError error         = Helpers.CreatePubnubClientError <T> (message, requestState,
                                                                                       activeChannel, errorType, severity);

                PubnubCallbacks.FireErrorCallback <T> (activeChannel, channelCallbacks,
                                                       callbackObjectType, responseType, errorLevel, error);
            }
        }
Ejemplo n.º 9
0
        internal static void CallErrorCallback <T>(ChannelEntity channelEntity, string message,
                                                   PubnubErrorCode errorCode, PubnubErrorSeverity severity,
                                                   PubnubErrorFilter.Level errorLevel)
        {
            List <ChannelEntity> channelEntities = new List <ChannelEntity> ();

            channelEntities.Add(channelEntity);
            PubnubClientError clientError = Helpers.CreatePubnubClientError <T> (message, null, channelEntities,
                                                                                 errorCode, severity);

            PubnubChannelCallback <T> channelCallback = channelEntity.ChannelParams.Callbacks as PubnubChannelCallback <T>;

            if (channelCallback != null)
            {
                #if (ENABLE_PUBNUB_LOGGING)
                LoggingMethod.WriteToLog(string.Format("DateTime {0}, CallErrorCallback calling GoToCallback: clientError={1} ", DateTime.Now.ToString(), clientError), LoggingMethod.LevelInfo);
                #endif

                GoToCallback(clientError, channelCallback.ErrorCallback, errorLevel);
            }
        }
Ejemplo n.º 10
0
        internal static void CallErrorCallback <T>(Exception ex,
                                                   List <ChannelEntity> channelEntities, PubnubErrorCode errorCode, PubnubErrorSeverity severity,
                                                   PubnubErrorFilter.Level errorLevel)
        {
            PubnubClientError clientError = Helpers.CreatePubnubClientError <T> (ex, null, channelEntities, errorCode, severity);

            CallCallbackForEachChannelEntity <T> (channelEntities, clientError, errorLevel);
        }
Ejemplo n.º 11
0
        internal static void CallErrorCallback <T>(WebException webEx,
                                                   RequestState <T> requestState, string channel, PubnubErrorSeverity severity,
                                                   Action <PubnubClientError> errorCallback, PubnubErrorFilter.Level errorLevel)
        {
            PubnubClientError clientError = Helpers.CreatePubnubClientError(webEx, requestState, channel, severity);

            GoToCallback(clientError, errorCallback, errorLevel);
        }
Ejemplo n.º 12
0
        internal static void CallErrorCallback <T>(string message,
                                                   RequestState <T> requestState, string channel, PubnubErrorCode errorCode, PubnubErrorSeverity severity,
                                                   Action <PubnubClientError> errorCallback, PubnubErrorFilter.Level errorLevel)
        {
            PubnubClientError clientError = Helpers.CreatePubnubClientError <T> (message, requestState, channel,
                                                                                 errorCode, severity);

            GoToCallback(clientError, errorCallback, errorLevel);
        }
Ejemplo n.º 13
0
		public PubnubClientError(int statusCode, PubnubErrorSeverity errorSeverity, string message, PubnubMessageSource source, PubnubWebRequest pubnubWebRequest, PubnubWebResponse pubnubWebResponse, string description, string channel)
		{
			_dateTimeGMT = DateTime.Now.ToUniversalTime();
			_statusCode = statusCode;
			_isDotNetException = false;
			_message = message;
			_errorSeverity = errorSeverity;
			_messageSource = source;
			_channel = channel;
			_detailedDotNetException = null;
			_pubnubWebRequest = pubnubWebRequest;
			_pubnubWebResponse = pubnubWebResponse;
			_description = description;
		}
Ejemplo n.º 14
0
        internal static PubnubClientError CreatePubnubClientError <T>(string message,
                                                                      RequestState <T> requestState, string channel, PubnubErrorCode errorCode, PubnubErrorSeverity severity)
        {
            int    statusCode       = (int)errorCode;
            string errorDescription = PubnubErrorCodeDescription.GetStatusCodeDescription(errorCode);

            PubnubClientError error = new PubnubClientError(statusCode, severity, message, PubnubMessageSource.Client,
                                                            (requestState == null)?null:requestState.Request, (requestState == null)?null:requestState.Response, errorDescription, channel);

            #if (ENABLE_PUBNUB_LOGGING)
            LoggingMethod.WriteToLog(string.Format("DateTime {0}, PubnubClientError = {1}", DateTime.Now.ToString(), error.ToString()), LoggingMethod.LevelInfo);
            #endif
            return(error);
        }
Ejemplo n.º 15
0
        internal static PubnubClientError CreatePubnubClientError <T>(WebException ex,
                                                                      RequestState <T> requestState, string channel, PubnubErrorSeverity severity)
        {
            PubnubErrorCode errorCode = PubnubErrorCodeHelper.GetErrorType(ex.Status, ex.Message);

            return(CreatePubnubClientError <T> (ex, requestState, channel, errorCode, severity));
        }
Ejemplo n.º 16
0
        internal static void CallErrorCallback <T>(string message,
                                                   Action <PubnubClientError> errorCallback, PubnubErrorCode errorCode, PubnubErrorSeverity severity,
                                                   PubnubErrorFilter.Level errorLevel)
        {
            //request state can be null

            PubnubClientError clientError = Helpers.CreatePubnubClientError <T> (message, null, null,
                                                                                 errorCode, severity);

            GoToCallback(clientError, errorCallback, errorLevel);
        }
Ejemplo n.º 17
0
        internal static void FireErrorCallbacksForAllChannelsCommon <T>(Exception ex, string message, RequestState <T> requestState,
                                                                        List <ChannelEntity> channelEntities,
                                                                        PubnubErrorSeverity severity, PubnubErrorCode errorType,
                                                                        ResponseType responseType, PubnubErrorFilter.Level errorLevel)
        {
            if ((channelEntities != null) && (channelEntities.Count > 0))
            {
                foreach (ChannelEntity channelEntity in channelEntities)
                {
                    string channel      = "";
                    string channelGroup = "";
                    if (channelEntity.ChannelID.IsChannelGroup)
                    {
                        channelGroup = channelEntity.ChannelID.ChannelOrChannelGroupName;
                    }
                    else
                    {
                        channel = channelEntity.ChannelID.ChannelOrChannelGroupName;
                    }

                    PubnubClientError error = null;
                    if (ex != null)
                    {
                        error = Helpers.CreatePubnubClientError <T> (ex, requestState, errorType,
                                                                     severity, channel, channelGroup);
                    }
                    else
                    {
                        error = Helpers.CreatePubnubClientError <T> (message, requestState, errorType,
                                                                     severity, channel, channelGroup);
                    }

                    FireErrorCallback <T> (channelEntity,
                                           errorLevel, error);
                }
            }

            else
            {
                if ((requestState != null) && (requestState.ErrorCallback != null))
                {
                    PubnubClientError error = null;
                    if (ex != null)
                    {
                        error = Helpers.CreatePubnubClientError <T> (ex, requestState, errorType,
                                                                     severity, "", "");
                    }
                    else
                    {
                        error = Helpers.CreatePubnubClientError <T> (message, requestState, errorType,
                                                                     severity, "", "");
                    }

                    GoToCallback(error, requestState.ErrorCallback, errorLevel);
                }
                #if (ENABLE_PUBNUB_LOGGING)
                else
                {
                    LoggingMethod.WriteToLog(string.Format("DateTime {0}, FireErrorCallbacksForAllChannelsCommon: {1}",
                                                           DateTime.Now.ToString(),
                                                           (requestState != null)?"ErrorCallback null":"requestState null"
                                                           ), LoggingMethod.LevelInfo);
                }
                LoggingMethod.WriteToLog(string.Format("DateTime {0}, FireErrorCallbacksForAllChannelsCommon: channelEntities count: {1}",
                                                       DateTime.Now.ToString(),
                                                       (channelEntities != null)?channelEntities.Count.ToString():"channelEntities null"
                                                       ), LoggingMethod.LevelInfo);
                #endif
            }
        }