Зазвичай я б зробив це:
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 #, але, як прокоментував А. Леві, воно могло застосовуватися до будь-якої мови обробки винятків, тому я змусив теги це відображати.