在多个方法之间抛出异常时,是否应该让所有方法重新抛出异常?例如:
Method1()
{
Method2();
}
Method2()
{
try
{
// Do something
}
catch
{
throw;
}
}
try
{
Method1();
}
catch
{
// Do something about exception that was thrown from Method2()
}
请注意,在
Method1()
中,我不需要将 Method2()
包裹在 try
块中,这样做必要吗?