Implement the SQLAlchemy ``handle_error()`` event.

This event hook is to be released as of SQLAlchemy 0.9.7, and
supersedes the existing SQLAlchemy ``dbapi_error()`` event, which
is called upon interception of all DBAPI errors and other exceptions
that are raised within core Engine operations.  The new event offers
the ability to intercept all errors associated with statement execution
and result reception, not just DBAPI-level errors, and also supports
re-raising of the given exception with a replacement exception.

Here, we implement a compatible system that works in SQLAlchemy 0.8
and forward.

partially implement bp: use-events-for-error-wrapping
Change-Id: Ife52be4ae870739dc296742fa4aefb3e31c36be4
Merge "Implement the SQLAlchemy ``handle_error()`` event."