FailureMessage() public method

public FailureMessage ( ) : string
return string
Ejemplo n.º 1
0
        private SendResponse ProcessResponse(HttpResponseMessage httpResponseMessage, ActivityPackage activityPackage)
        {
            var sendResponse = new SendResponse
            {
                WillRetry = false,
                JsonDict  = Util.ParseJsonResponse(httpResponseMessage),
            };

            if (httpResponseMessage.StatusCode == HttpStatusCode.InternalServerError || // 500
                httpResponseMessage.StatusCode == HttpStatusCode.NotImplemented)        // 501
            {
                Logger.Error("{0}. (Status code: {1}).",
                             activityPackage.FailureMessage(),
                             (int)httpResponseMessage.StatusCode);
            }
            else if (!httpResponseMessage.IsSuccessStatusCode)
            {
                sendResponse.WillRetry = true;

                Logger.Error("{0}. (Status code: {1}). Will retry later.",
                             activityPackage.FailureMessage(),
                             (int)httpResponseMessage.StatusCode);
            }

            return(sendResponse);
        }
Ejemplo n.º 2
0
        private SendResponse ProcessException(Exception exception, ActivityPackage activityPackage)
        {
            Logger.Error("{0}. ({1}). Will retry later", activityPackage.FailureMessage(), Util.ExtractExceptionMessage(exception));

            return(new SendResponse
            {
                WillRetry = true,
            });
        }
Ejemplo n.º 3
0
        private void LogSendErrorI(ResponseData responseData, ActivityPackage activityPackage)
        {
            var errorMessagBuilder = new StringBuilder(activityPackage.FailureMessage());

            if (responseData.Exception != null)
            {
                errorMessagBuilder.AppendFormat(" ({0})", Util.ExtractExceptionMessage(responseData.Exception));
            }
            if (responseData.StatusCode.HasValue)
            {
                errorMessagBuilder.AppendFormat(" (Status code: {0})", responseData.StatusCode.Value);
            }
            if (responseData.WillRetry)
            {
                errorMessagBuilder.Append(" Will retry later");
            }

            _logger.Error("{0}", errorMessagBuilder.ToString());
        }
Ejemplo n.º 4
0
        private SendResponse ProcessException(WebException webException, ActivityPackage activityPackage)
        {
            using (var response = webException.Response as HttpWebResponse)
            {
                int?statusCode = (response == null) ? null : (int?)response.StatusCode;

                var sendResponse = new SendResponse
                {
                    WillRetry = true,
                    JsonDict  = Util.ParseJsonExceptionResponse(response)
                };

                Logger.Error("{0}. ({1}, Status code: {2}). Will retry later.",
                             activityPackage.FailureMessage(),
                             Util.ExtractExceptionMessage(webException),
                             statusCode);

                return(sendResponse);
            }
        }
Ejemplo n.º 5
0
        private SendResponse ProcessException(WebException webException, ActivityPackage activityPackage)
        {
            using (var response = webException.Response as HttpWebResponse)
            {
                int? statusCode = (response == null) ? null : (int?)response.StatusCode;

                var sendResponse = new SendResponse
                {
                    WillRetry = true,
                    JsonDict = Util.ParseJsonExceptionResponse(response)
                };

                Logger.Error("{0}. ({1}, Status code: {2}). Will retry later.",
                    activityPackage.FailureMessage(),
                    Util.ExtractExceptionMessage(webException),
                    statusCode);

                return sendResponse;
            }
        }
Ejemplo n.º 6
0
        private SendResponse ProcessResponse(HttpResponseMessage httpResponseMessage, ActivityPackage activityPackage)
        {
            var sendResponse = new SendResponse
            {
                WillRetry = false,
                JsonDict = Util.ParseJsonResponse(httpResponseMessage),
            };

            if (httpResponseMessage.StatusCode == HttpStatusCode.InternalServerError   // 500
                || httpResponseMessage.StatusCode == HttpStatusCode.NotImplemented)    // 501
            {
                Logger.Error("{0}. (Status code: {1}).",
                    activityPackage.FailureMessage(),
                    (int)httpResponseMessage.StatusCode);
            }
            else if (!httpResponseMessage.IsSuccessStatusCode)
            {
                sendResponse.WillRetry = true;

                Logger.Error("{0}. (Status code: {1}). Will retry later.",
                    activityPackage.FailureMessage(),
                    (int)httpResponseMessage.StatusCode);
            }

            return sendResponse;
        }
Ejemplo n.º 7
0
        private SendResponse ProcessException(Exception exception, ActivityPackage activityPackage)
        {
            Logger.Error("{0}. ({1}). Will retry later", activityPackage.FailureMessage(), Util.ExtractExceptionMessage(exception));

            return new SendResponse
            {
                WillRetry = true,
            };
        }