Quote:

Agreed - this is a sign of bad coding




No, it's not.

It can of course be abused to produce poor or lazy coding, but it can also be used in a constructive manner as an exception trap.

I would much rather have a generic exception trap to email me when a login script abends for an unforseen reason than have the user whining that he hasn't had mapped drives/printers for 6 weeks and hasn't told anyone earlier.

There will always be problems caused by invalid data, corrupt files, typos in scripts/configuration files, unexpected information being returned by COM interfaces and so-on.

You can test your scripts until you are blue in the face, but if your script is running live for two years before you get your first user with an "$" in his name which causes your script to blow up if would be nice if it could alert you rather than silently failing.

This is even more important for stealth scripts with no console.

So, being able to register a handler to deal with unexpected errors and abends is not in itself a bad thing.