Browse Source

2007-05-21 Igor Zelmanovich <[email protected]>

	* DataSourceView.cs: refactoring: Update, Insert methods:
	exception is re-thrown from catch scope. 
	It allows actual call stack be shown	


svn path=/trunk/mcs/; revision=77740
Igor Zelmanovich 18 years ago
parent
commit
b882ea3542

+ 6 - 0
mcs/class/System.Web/System.Web.UI/ChangeLog

@@ -1,3 +1,9 @@
+2007-05-21 Igor Zelmanovich <[email protected]>
+
+	* DataSourceView.cs: refactoring: Update, Insert methods:
+	exception is re-thrown from catch scope. 
+	It allows actual call stack be shown	
+
 2007-05-17  Vladimir Krasnov  <[email protected]>
 
 	* TemplateControl.jvm.cs: refactored key for CachedString method

+ 12 - 12
mcs/class/System.Web/System.Web.UI/DataSourceView.cs

@@ -57,12 +57,12 @@ namespace System.Web.UI {
 			if (callBack == null)
 				throw new ArgumentNullException ("callBack");
 
-			int rowAffected = 0;
+			int rowAffected;
 			try {
 				rowAffected = ExecuteDelete (keys, values);
 			}
 			catch (Exception e) {
-				if (!callBack (rowAffected, e))
+				if (!callBack (0, e))
 					throw;
 				return;
 			}
@@ -94,16 +94,16 @@ namespace System.Web.UI {
 			if (callBack == null)
 				throw new ArgumentNullException("callBack");
 
-			int rowAffected = 0;
-			Exception passOn = null;
+			int rowAffected;
 			try {
 				rowAffected = ExecuteInsert (values);
 			} catch (Exception e) {
-				passOn = e;
+				if (!callBack (0, e))
+					throw;
+				return;
 			}
 
-			if (!callBack (rowAffected, passOn) && passOn != null)
-				throw passOn;
+			callBack (rowAffected, null);
 		}
 
 		protected virtual void OnDataSourceViewChanged (EventArgs eventArgs)
@@ -151,16 +151,16 @@ namespace System.Web.UI {
 			if (callBack == null)
 				throw new ArgumentNullException ("callBack");
 
-			int rowAffected = 0;
-			Exception passOn = null;
+			int rowAffected;
 			try {
 				rowAffected = ExecuteUpdate (keys, values, oldValues);
 			} catch (Exception e) {
-				passOn = e;
+				if (!callBack (0, e))
+					throw;
+				return;
 			}
 
-			if (!callBack (rowAffected, passOn) && passOn != null)
-				throw passOn;
+			callBack (rowAffected, null);
 		} 
 		
 		public virtual bool CanDelete { get { return false; } }