Exemplo n.º 1
0
 protected HttpResponseException(SerializationInfo info, StreamingContext context) : base(info, context)
 {
     if (info != null)
     {
         this.requestUri = (Uri) info.GetValue("RequestUri", typeof(Uri));
         this.requestMethod = (HttpMethod) info.GetValue("RequestMethod", typeof(HttpMethod));
         this.response = (HttpResponseMessage<byte[]>) info.GetValue("Response", typeof(HttpResponseMessage<byte[]>));
     }
 }
        public virtual void HandleError(Uri requestUri, HttpMethod requestMethod, HttpResponseMessage<byte[]> response)
        {
            switch (((int) (response.StatusCode / HttpStatusCode.Continue)))
            {
                case 4:
                    throw new HttpClientErrorException(requestUri, requestMethod, response);

                case 5:
                    throw new HttpServerErrorException(requestUri, requestMethod, response);
            }
            throw new HttpResponseException(requestUri, requestMethod, response);
        }
Exemplo n.º 3
0
 public HttpResponseException(Uri requestUri, HttpMethod requestMethod, HttpResponseMessage<byte[]> response) : base(string.Format("{0} request for '{1}' resulted in {2:d} - {2} ({3}).", new object[] { requestMethod, requestUri, response.StatusCode, response.StatusDescription }))
 {
     this.requestUri = requestUri;
     this.requestMethod = requestMethod;
     this.response = response;
 }
 public HttpClientErrorException(Uri requestUri, HttpMethod requestMethod, HttpResponseMessage<byte[]> response) : base(requestUri, requestMethod, response)
 {
 }