Skip to content

Commit

Permalink
Throw application-specific exception instead of type-cast
Browse files Browse the repository at this point in the history
svn path=/trunk/mcs/; revision=62231
  • Loading branch information
Andrew Skiba committed Jul 3, 2006
1 parent 003379d commit ba63dab
Showing 1 changed file with 3 additions and 1 deletion.
Expand Up @@ -66,7 +66,9 @@ private static HttpWorkerRequest GetMyWorkerRequest ()

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 ();
Expand Down

0 comments on commit ba63dab

Please sign in to comment.