+Exception Handling
+------------------
+
+Avoid finally: blocks in favor of explict catches because a throw
+from a finally block will lose any pending exception. An explicit
+catch can chain it (see below).
+
+To behave similarly under Python 2 and 3, use add_ex_tb() to
+explicitly add stack traces to any exceptions that are going to be
+re-raised by anything other than a no-argument raise (otherwise the
+stack trace will be lost)::
+
+ try:
+ ...
+ except ... as ex:
+ add_ex_tb(ex)
+ pending_ex = ex
+ ...
+ raise pending_ex
+
+When an exception is thrown from an exception handler, the pending
+exception should be the `"context"
+<https://docs.python.org/3/reference/simple_stmts.html#the-raise-statement>`_
+of the new exception, which can be accomplished (portably) via
+``pending_raise()``::
+
+ try:
+ ...
+ except ... as ex:
+ with pending_raise(ex):
+ clean_up()
+
+This should do roughly the same thing in Python 2 and Python 3,
+throwing any exception from ``clean_up()`` after adding ex as the
+``__context__`` if clean_up() throws, and throwing ``ex`` otherwise.
+
+If for some reason, you need more control, you can use
+``add_ex_ctx()`` directly::