Excpetion Handling

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Consider this....
public sqldatareader somefunction(){
try
{
sqldatareader sr=sqlcommand.executereader();
return sr;
}
catch
{
throw;
}
}

my question is why bother with try/catch, if I have to throw an exception?
 
In this specific case, you would not gain anything since your catch is not
doing anything other then rethrowing the exception, and you don't have a
finally block.
 
Thanks for your response...

So, I'm going to handle the exception at client side (caller of the method).
Just curious , what would be the best way to handle exceptions in this or
similar cases...Any best practices?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top