Example #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="qiniu.QiniuWebException"/> class.
 /// </summary>
 /// <param name="we">We.</param>
 public QiniuWebException(WebException we)
 {
     if (we.Response is HttpWebResponse)
     {
         HttpWebResponse hwr = we.Response as HttpWebResponse;
         this.error   = new QiniuErrors((int)hwr.StatusCode);
         this.x_Reqid = hwr.Headers ["X-Reqid"];
         this.x_Log   = hwr.Headers ["X-Log"];
     }
 }
Example #2
0
 public QiniuWebException(Exception we)
 {
     this.error   = new QiniuErrors(0, we.Message);
     this.x_Log   = "";
     this.x_Reqid = "";
     //this.StackTrace = we.StackTrace;
     this.HelpLink = we.HelpLink;
     //this.InnerException = we.InnerException;
     //this.Message = we.Message;
     this.Source = we.Source;
     //this.TargetSite = we.TargetSite;
 }
Example #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="qiniu.QiniuWebException"/> class.
 /// </summary>
 /// <param name="we">We.</param>
 public QiniuWebException(WebException we)
 {
     if (we.Response is HttpWebResponse)
     {
         HttpWebResponse hwr     = we.Response as HttpWebResponse;
         string          content = "";
         using (StreamReader sr = new StreamReader(hwr.GetResponseStream()))
         {
             content = sr.ReadToEnd();
         }
         this.error   = new QiniuErrors((int)hwr.StatusCode, content);
         this.x_Reqid = hwr.Headers ["X-Reqid"];
         this.x_Log   = hwr.Headers ["X-Log"];
     }
 }