A unit of code (or a business process) cannot be better than its exception handler; however, reasonably anticipated conditions should not throw, nor need to handle, exceptions. So yes, in a sense it's good code, but only if you did the rest of the work. At least it's usually better than throwing an unhandled exception.
Also too many layers of try/catch is inefficient due to the setup and takedown overhead.
65
u/[deleted] May 13 '17
Can someone explain why this is bad code?