Add missing param to error handler
Improved error handling (catch and report all)

We report the error code. The MySQL documentation allows users to find
what that matches to, although this is probably something we'll want to
mention somewhere