Hi,
since our programmer has left the team, I am now responsible for the maintenance of our business tool (without being a programmer, really). The tool has historically grown and hence the code is quite messy at times. It consists of huge methods that are encapsulated in cascaded try catch blocks.
I know try catch blocks are best practice, but with huge methods they cause some serious trouble: If the program crashes (while debugging), it won't stop at the flawed piece of code, but rather in the catch block. So, apart from the often not so informative error message, I have no real way of telling which of part of the huge code segment within the try block caused the problem.
The only workaround I've figured out so far is quite tedious: Comment out all the try-catch "surroundings", let the program run and see where it crashes. Without try-catch blocks, it stops right at the erroneous line.
Now, this can't really be it, can it? There must be a way to see which line of code caused the crash even when the try-catch block is active, I am sure of it. I just can't figure out how, and can't google any useful information on that topic, neither.
Any insight is greatly appreciated.
Thank you very much!
- Pesche