Permalink
Browse files

Fixed Sharpen.HttpURLConnection.Response to handle a thrown WebExcept…

…ion when calling HttpWebRequest.GetResponse().
  • Loading branch information...
1 parent 263a79f commit a4524a76d523ec0e15ed0a1cf22ace4986d37f1e @fealebenpae fealebenpae committed with slluis Jun 23, 2011
Showing with 10 additions and 1 deletion.
  1. +10 −1 Sharpen/Sharpen/HttpURLConnection.cs
@@ -64,7 +64,16 @@ internal HttpURLConnection (Uri uri, Proxy p)
HttpWebResponse Response {
get {
if (reqResponse == null)
- reqResponse = (HttpWebResponse) request.GetResponse ();
+ {
+ try
+ {
+ reqResponse = (HttpWebResponse) request.GetResponse ();
+ }
+ catch (WebException ex)
+ {
+ reqResponse = (HttpWebResponse) ex.Response;
+ }
+ }
return reqResponse;
}
}

0 comments on commit a4524a7

Please sign in to comment.