DB errors, like any PHP error as well, throw exceptions. They can be caught if the code needs it (to ignore errors, for example). If they aren't caught, they propagate up to the nice "server error" error handler, which a few people have seen

That error handler automatically logs the error with line and backtrace info, as well as the URL, user, and GET/POST info in it. I already used it to track down a few errors today.
There's no interface for it yet though, so I'm using straight MySQL.