Author: andrews
Date: 2006-07-03 11:35:14 -0400 (Mon, 03 Jul 2006)
New Revision: 62231

Modified:
   trunk/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/MyHost.cs
Log:
Throw application-specific exception instead of type-cast

Modified: trunk/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/MyHost.cs
===================================================================
--- trunk/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/MyHost.cs        
2006-07-03 15:31:14 UTC (rev 62230)
+++ trunk/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/MyHost.cs        
2006-07-03 15:35:14 UTC (rev 62231)
@@ -66,7 +66,9 @@
 
                private static MyData GetMyData (HttpWorkerRequest wr)
                {
-                       IForeignData fd = (IForeignData) wr;
+                       IForeignData fd = wr as IForeignData;
+                       if (fd == null)
+                               throw new ArgumentException ("Invalid worker 
request. Probable reason is using WebTest.Invoke from a real web application");
                        MyData d = (MyData) fd[typeof (MyHost)];
                        if (d == null) {
                                d = new MyData ();

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to