Beispiel #1
0
        private void LogError(string url, HttpResponseMessage response)
        {
            string info = "Request to " + url + " failed with status code " + response.StatusCode +
                          "content: " + response.Content;
            //Acquire the actual exception
            var ex = new Exception(info);

            info = string.Empty;

            //Log the exception and info message
            SentryLogger.Log(ex);
            throw ex;
        }
Beispiel #2
0
        private async Task <KKCommonResponse> serializeBodyAsync(dynamic result, string url)
        {
            if (!result.IsSuccessStatusCode)
            {
                LogError(url, result);
            }
            ;

            var resultContentString = await result.Content.ReadAsStringAsync();

            KKCommonResponse resultObj = serializer.Deserialize <KKCommonResponse>(resultContentString);

            result.Dispose();
            if (resultObj.status != 200)
            {
                var e = new KKHttpException(url, resultObj);
                SentryLogger.Log(e);
            }
            return(resultObj);
        }