コード例 #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[]>));
     }
 }
コード例 #2
0
        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);
        }
コード例 #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;
 }
コード例 #4
0
 public HttpClientErrorException(Uri requestUri, HttpMethod requestMethod, HttpResponseMessage<byte[]> response) : base(requestUri, requestMethod, response)
 {
 }