OmegaChartのソースコードの保守
Revision | 09b9b86e3394638bd0a921aa679cd7ebbd07df50 (tree) |
---|---|
Zeit | 2013-05-09 22:23:41 |
Autor | panacoran <panacoran@user...> |
Commiter | panacoran |
HTTPエラー時のメッセージにURLを追加する
@@ -104,8 +104,17 @@ namespace Zanetti | ||
104 | 104 | rq.ProtocolVersion = new Version(1,1); |
105 | 105 | rq.Method = "GET"; |
106 | 106 | rq.Proxy = proxy; |
107 | - HttpWebResponse rs = (HttpWebResponse)rq.GetResponse(); | |
108 | - | |
107 | + HttpWebResponse rs; | |
108 | + try | |
109 | + { | |
110 | + rs = (HttpWebResponse)rq.GetResponse(); | |
111 | + } | |
112 | + catch (WebException e) | |
113 | + { | |
114 | + if (e.Status != WebExceptionStatus.ProtocolError) | |
115 | + throw; | |
116 | + throw new Exception(e.Message + ": " + e.Response.ResponseUri, e); | |
117 | + } | |
109 | 118 | //効率はわるいがWinHTTPが使えない環境用なのでまあいいだろう |
110 | 119 | MemoryStream strm = new MemoryStream(0x18000); |
111 | 120 | CopyStream(rs.GetResponseStream(), strm); |