Browse Source

2009-07-28 Gonzalo Paniagua Javier <[email protected]>

	* WebClient.cs: rethrow WebExceptions instead of creating a new one
	with less information on the actual error.
	Fixes bug #526069.


svn path=/trunk/mcs/; revision=138855
Gonzalo Paniagua Javier 16 years ago
parent
commit
de80b74af3
2 changed files with 18 additions and 0 deletions
  1. 6 0
      mcs/class/System/System.Net/ChangeLog
  2. 12 0
      mcs/class/System/System.Net/WebClient.cs

+ 6 - 0
mcs/class/System/System.Net/ChangeLog

@@ -1,3 +1,9 @@
+2009-07-28 Gonzalo Paniagua Javier <[email protected]>
+
+	* WebClient.cs: rethrow WebExceptions instead of creating a new one
+	with less information on the actual error.
+	Fixes bug #526069.
+
 2009-07-22 Gonzalo Paniagua Javier <[email protected]>
 
 	* WebHeaderCollection.cs: check the validity of the characters in the

+ 12 - 0
mcs/class/System/System.Net/WebClient.cs

@@ -279,6 +279,8 @@ namespace System.Net
 				if (request != null)
 					request.Abort ();
 				throw;
+			} catch (WebException wexc) {
+				throw;
 			} catch (Exception ex) {
 				throw new WebException ("An error occurred " +
 					"performing a WebClient request.", ex);
@@ -315,6 +317,8 @@ namespace System.Net
 				async = false;
 #endif				
 				DownloadFileCore (address, fileName, null);
+			} catch (WebException wexc) {
+				throw;
 			} catch (Exception ex) {
 				throw new WebException ("An error occurred " +
 					"performing a WebClient request.", ex);
@@ -391,6 +395,8 @@ namespace System.Net
 				request = SetupRequest (address);
 				WebResponse response = GetWebResponse (request);
 				return response.GetResponseStream ();
+			} catch (WebException wexc) {
+				throw;
 			} catch (Exception ex) {
 				throw new WebException ("An error occurred " +
 					"performing a WebClient request.", ex);
@@ -446,6 +452,8 @@ namespace System.Net
 #endif				
 				WebRequest request = SetupRequest (address, method, true);
 				return request.GetRequestStream ();
+			} catch (WebException wexc) {
+				throw;
 			} catch (Exception ex) {
 				throw new WebException ("An error occurred " +
 					"performing a WebClient request.", ex);
@@ -594,6 +602,8 @@ namespace System.Net
 				async = false;
 #endif				
 				return UploadFileCore (address, method, fileName, null);
+			} catch (WebException wexc) {
+				throw;
 			} catch (Exception ex) {
 				throw new WebException ("An error occurred " +
 					"performing a WebClient request.", ex);
@@ -715,6 +725,8 @@ namespace System.Net
 				async = false;
 #endif				
 				return UploadValuesCore (address, method, data, null);
+			} catch (WebException wexc) {
+				throw;
 			} catch (Exception ex) {
 				throw new WebException ("An error occurred " +
 					"performing a WebClient request.", ex);