Killing my web service

  • Thread starter Thread starter Eric
  • Start date Start date
E

Eric

Hello,

I've written a c# web service that functions as a test harness. It
mimics the user interface of a client's web service. I would like to
make it die based on being passed in a certain parameter, so that I can
simulate a timeout. The actual time out is configurable in the
application that calls my test harness and my test harness isn't aware
of what this is set to.

I'm looking for:

public function myfunction (string param1, string param2)
{
if (this == that)
{
//something should go here to exit the web service without
returning anything.
throw new MyTimeOut();
}
catch ( MyTimeOut ex )
{
//Just fall into the finally block
}
finally
{
}
}

public class MyTimeOut : System.ApplicationException
{
}

I tried throwing a custom exception as shown above, but got the error
message that not all code paths returned a value.

-Eric
 
Eric said:
Hello,

I've written a c# web service that functions as a test harness. It
mimics the user interface of a client's web service. I would like to
make it die based on being passed in a certain parameter, so that I can
simulate a timeout. The actual time out is configurable in the
application that calls my test harness and my test harness isn't aware
of what this is set to.

I'm looking for:

public function myfunction (string param1, string param2)
{
if (this == that)
{
//something should go here to exit the web service without
returning anything.
throw new MyTimeOut();
}
catch ( MyTimeOut ex )
{
//Just fall into the finally block
}
finally
{
}
}

public class MyTimeOut : System.ApplicationException
{
}

I tried throwing a custom exception as shown above, but got the error
message that not all code paths returned a value.

Because they don't.
Place a return value (dummy value perhaps) in the last line and you'll be
fine.
 
Back
Top