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)); }
static void ParseCheckSocketConnectException <T> (Exception ex, string[] channels, string[] channelGroups, Action <PubnubClientError> errorCallback, Action <bool> callback) { PubnubErrorCode errorType = PubnubErrorCodeHelper.GetErrorType(ex); int statusCode = (int)errorType; string errorDescription = PubnubErrorCodeDescription.GetStatusCodeDescription(errorType); PubnubClientError error = new PubnubClientError(statusCode, PubnubErrorSeverity.Warn, true, ex.Message, ex, PubnubMessageSource.Client, null, null, errorDescription, string.Join(",", channels), string.Join(",", channelGroups)); GoToCallback(error, errorCallback); LoggingMethod.WriteToLog(string.Format("DateTime {0} checkInternetStatus Error. {1}", DateTime.Now.ToString(), ex.ToString()), LoggingMethod.LevelError); callback(false); }
internal static PubnubClientError CreatePubnubClientError <T>(Exception ex, RequestState <T> requestState, string channel, PubnubErrorCode errorCode, PubnubErrorSeverity severity) { if (errorCode.Equals(PubnubErrorCode.None)) { errorCode = PubnubErrorCodeHelper.GetErrorType(ex); } int statusCode = (int)errorCode; string errorDescription = PubnubErrorCodeDescription.GetStatusCodeDescription(errorCode); PubnubClientError error = new PubnubClientError(statusCode, severity, true, ex.Message, ex, 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); }