Smaller Try-Blocks Are Better

It often happens, especiallyin Java, that a few places in the methodare potential exception originators. Usually, we make a large method-sizetry block with a single catch at the bottom. We catch allthe exceptions, usually even usinggrouping.This helps us minimize the noise, which is the exception catching.However, such large try blocks jeopardize maintainability: we are unableto provide proper error contextinside catch blocks.

[image error]The Rum Diary (2011) by Bruce Robinson

What do you think...

 •  0 comments  •  flag
Share on Twitter
Published on September 07, 2022 17:00
No comments have been added yet.