Обычно я бы сделал это:
try
{
code
code that might throw an anticipated exception you want to handle
code
code that might throw an anticipated exception you want to handle
code
}
catch
{
}
Есть ли какая-то польза от этого?
code
try
{
code that might throw an anticipated exception you want to handle
}
catch
{
}
code
try
{
code that might throw an anticipated exception you want to handle
}
catch
{
}
code
Обновление:
Первоначально я задавал этот вопрос со ссылкой на C #, но, как прокомментировал А. Леви, он может применяться к любому языку обработки исключений, поэтому я заставил теги отражать это.