in reply to dbi: PrintError and RaiseError

In general, RaiseError is a good idea. However, if, as an example, you were developing yet another Object-relational mapping system, you may want your objects to handle the errors, so you'd turn both PrintError and RaiseError off, and then check for errors and maybe throw an exception as appropriate, for the caller to handle. Since this is another full-fledged exception object at this point, you won't run into zwon's issue of figuring out what type of error it is, and can just handle it appropriately.

Once you've started down this road, perhaps you find problems that your ORM isn't handling quite right, so you want to know what the problem is. You may want to simply enable PrintError in a single location (the connect), and then watch the console for errors. Once you figure out what you're not handling correctly, you can add in the logic, and then turn it back off.

Of course, I'm just grasping at straws here - there are infinite reasons for wanting to do things, not all of them good reasons. But I don't know which, if any, might apply to your situation.