try
{
return myService.GetData();
}
catch (Exception ex)
{
Log.Error(ex.ToString());
return null;
// Now the caller has to deal with a myserious null value, with no
// indication that something went wrong.
}
try
{
return myService.GetData();
}
catch (MyServiceException ex)
{
Log.Error(ex.ToString());
throw; // note: *NOT* throw ex;
// This time, the caller is notified that something went wrong, and can take
// steps to recover, or allow the exception to propagate up the stack.
}
// If the data is critical to the page - in other words, the page is useless without
// it - just the exception bubble it up to the global exception handler.
return myService.GetData();