3 ms·
> You just enable it before a risky call so your program won't crash, do the call, disable it and validate the result of the call before using it. This way you
by geon 5y ago
> You just enable it before a risky call so your program won't crash, do the call, disable it and validate the result of the call before using it. This way you just don't have to clutter your code with endless try-catch-finally clauses.
How is that in any way better than try/catch? It would be just as mush code, but without the syntax ensuring you disable it.
- qwerty456127 5y agoPerhaps you are right. But at least it's less nesting and I'm not sure special syntax to ensure you disable it is necessary - finding all occurrences of "On Error Resume Next" and matching "On Error Resume 0" statements is trivial. Both ways feel tidy than the other in their own way.
- feoren 5y agoI'm guessing you haven't seen a try/catch block in VB6 / VBA. It's not like a C code block; it's just another goto statement. What GP describes is much better because it's localized: control flow follows line after line. Try/catch blocks in VB6 scramble your control flow. And you still have lots of things you need to remember to do with that approach.